Process Management in CMSC 412: PCBs, Queues, Forking, and Process Termination - Prof. Jef, Study notes of Operating Systems

An overview of process management concepts covered in lecture 4 of cmsc 412, including the process control block (pcb), storing pcbs in a process table, queues of processes based on state, forking a new process, process termination, and threads. The document also discusses the role of the dispatcher in process management.

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-yzw
koofers-user-yzw 🇺🇸

10 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CMSC 412 – S02 (lect 4)
Announcements
zProgram #1
Is on the web
zReading
Chapter 4
Chapter 6 (for Tuesday)
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Process Management in CMSC 412: PCBs, Queues, Forking, and Process Termination - Prof. Jef and more Study notes Operating Systems in PDF only on Docsity!

Announcements

z^

Program #1– Is on the web

z^

Reading– Chapter 4– Chapter 6 (for Tuesday)

Process Control Block

z^

Stores all of the information about a process

z^

PCB contains– process state: new, ready, etc.– processor registers– Memory Management Information

  • page tables, and limit registers for segments
    • CPU scheduling information
      • process priority• pointers to process queues
        • Accounting information
          • time used (and limits)• files used• program owner
            • I/O status information
              • list of open files• pending I/O operations

Queues of Processes

z^

Store processes in queues based on state

P

P

ReadyQueue

P

P

DiskQueue

P

P

NetworkQueue

forking a new process

z^

create a PCB for the new process– copy most entries from the parent– clear accounting fields– buffered pending I/O– allocate a pid (process id for the new process)

z^

allocate memory for it– could require copying all of the parents segments– however, text segment usually doesn’t change so that could

be shared

  • might be able to use memory mapping hardware to help
    • will talk more about this in the memory management part of the class

z^

add it to the ready queue

Termination (cont.) - UNIX example

z^

Kernel– frees memory used by the process– moved process control block to the terminated queue

z^

Terminated process– signals parent of its death (SIGCHILD)– is called a zombie in UNIX– remains around waiting to be reclaimed

z^

parent process– wait system call retrieves info about the dead process

  • exit status• accounting information
    • signal handler is generally called the reaper
      • since its job is to collect the dead processes

Threads

z^

processes can be a heavy (expensive) object

z^

threads are like processes but generally a collectionof threads will share– memory (except stack)– open files (and buffered data)– signals

z^

can be user or system level– user level: kernel sees one process

  • easy to implement by users- I/O management is difficult- in an multi-processor can’t get parallelism
  • system level: kernel schedules threads

Dispatcher

z^

The inner most part of the OS that runs processes

z^

Responsible for:– saving state into PCB when switching to a new process– selecting a process to run (from the ready queue)– loading state of another process

z^

Sometimes called the short term scheduler– but does more than schedule

z^

Switching between processes is called contextswitching

z^

One of the most time critical parts of the OS

z^

Almost never can be written completely in a highlevel language