3 분 소요

image


Process Management (2)


Scheduling Queues


Ready queue

  • Processes in ready state
    • Requesting processor, all other resources allocated
  • Ready queue (ready list)
  • Process scheduling
    • Selecting a process from the ready list and dispatch it when the processor is available


image


I/O queue

  • Processes in asleep state
    • Each requesting different resources
  • Block list (block queue, I/O queue)
    • Separate list for each resource

image


Schedulers


Classification of schedulers

  • Long-term scheduler (job scheduler)
    • Controls the multiprogramming degree
    • Selects a good process mix
      • I/O-bound processes and CPU-bound processes
    • Not used on some systems
  • Medium-term scheduler
    • Swapping
  • Short-term scheduler (process scheduler)
    • Considers several performance indices such as throughput and response time


image


Interrupts

: Unexpected (external) event

  • Kinds of interrupts
    • I/O interrupt
    • Clock interrupt
    • Console interrupt
    • Machine check interrupt
    • Inter-process communication interrupt
    • Etc


Interrupt handling

  • Interrupt hadling process

image


image

  • Interrupt > Context saving > Interrupt handling > Interrupt service > Context restoring


Interrupts and Traps

  • System Calls, Interrupts, and Exceptions

image


Context Switching


Context

  • Set of information related to a process
    • User-level context
    • System-level context
    • Register context


Context switching

  • Context saving
    • Saving the register context of a process when the process releases processor
  • Context restoring
    • Reloading the register context of a process to continue execution
  • Context switching
    • Saving the context of a process and restoring the context of another process


Information in PCB

  • PID (Process Identification Number)
  • Process state
  • Scheduling information
    • Process priority, scheduling parameters, etc.
  • Memory management information
    • Base/limit registers, page tables, segment tables, etc.
  • I/O status information
    • List of I/O devices allocated, list of open files, etc.
  • Accounting information
  • Context save area
    • Space for saving register context of the process


Context switch time

  • Pure overhead
  • Highly dependent on hardware support
    • Some processors provide multiple sets of registers
      • Context switch by changing the pointer to the current register set
      • Sun UltraSPARC


  • $P_A$ running > interrupt > [ Context saving > IH > ISR > Scheduling > Context restoring ] > $P_B$ running




IPC (Inter-Process Communication)


  • Reasons for process cooperation
    • Information sharing
    • Computation speedup
    • Modularity
    • Convenience
  • Schemes
    • Message passing and shared memory
    • In distributed systems
      • Message passing
      • RPC(Remote Procedure Call)
      • DSM(Distributed Shared Memory)


Message Passing


  • Primitives
    • Direct/indirect communication
      • send(P, message), receive(Q, message)
      • send(mailbox, message), receive(mailbox, message)
  • Issues
    • Synchronization mechanism
      • Blocking/non-blocking send/receive
    • Buffering mechanism
    • Etc


image


Shared Memory

  • Primitives
    • Indirect communication
      • read(buf, message), write(message, buf)


image


RPC (Remote Procedure Call)

  • A way to abstract the procedure call mechanism for use between systems with network connections
    • Allows a client to invoke a procedure on a remote host as it would invoke a procedure locally
    • Hides the communication-level details
  • Usually built on top of the message passing framework
  • Terminologies
    • Client stub, server stub
    • Marshalling, unmarshalling
    • Matchmaker (rendezvous)
    • XDR(eXternal Data Representation)


image


RMI (Remote Method Invocation)

  • Java feature similar to RPC
    • Object-based
    • Allows a thread to invoke a method on a remote object
  • Built on JVM
  • Terminologies
    • Stub, skeleton
    • Parcel


LRPC (Lightweight RPC)

  • Supports communication between two processes on the same machine
  • Similar to standard RPC
    • Optimized for local communications


DSM (Distributed Shared Memory)

  • Also called DSVM(Distributed Shared Virtual Memory)
  • A shared-memory paradigm applied to loosely-coupled distributed memory systems
    • An abstraction that integrates the local memory of different machines in a network environment into a single logical entity shared by cooperating processes executing on multiple hosts
      • A software layer on top of the message-passing communication system to provide a shared-memory abstraction to the programmers (in loosely-coupled distributed systems)
    • Can be implemented either in the OS kernel or in runtime library routines with proper system kernel support


image


Summary

  • Process concept
    • An entity that is registered to the kernel
    • Can request/allocate/release resources in the system
  • Process state transition
  • PCB
    • Area for maintaining information about each process
  • Scheduling queues and schedulers
  • Interrupt, context saving, context switching
  • Inter-process communication
    • Message passing, RPC/RMI/LPC
    • Shared memory

댓글남기기