processes - Computer Science 322 Operating Systems Mount...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science 322 Operating Systems Mount Holyoke College Spring 2008 Topic Notes: Processes and Threads What is a process? Our text defines it as “an abstraction of a running program.” Definitions from other textbooks: A program in execution (good one) An asynchronous activity the “locus of control” of a program in execution that which is manifest by the existence of a process control block in the OS that entity which is assigned to processors the “dispatchable” unit the “animated spirit” of a procedure A process is sequential. Parts of a process: program code (text section) program counter and other registers stack (local variables and function call information) data (global variables) A typical multiprogrammed system has many processes at any time. Try ps -aux or ps -ef to see the processes on your favorite Unix system. Only one of these can be on the processor at a time. So if a process is in the system but not executing on the CPU, where is it? States of a process: new ready terminated running waiting creation preemption dispatch I/O event I/O completion exit
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Operating Systems Spring 2008 What information do we need to let a process transition among these states? Think about it in terms of what a person needs to do to get back to what he or she was doing before being interrupted. you’re sitting in the lab working hard on your OS project and someone interrupts you your attention shifts and you go off and do something else for a while then when you need to come back to the work, you need to remember what you were doing, and where you were in the process of doing it We do this all the time, and many of us are really pretty good at it. A processor can’t just pick up where it left off, unless we carefully remember everything it was doing when it was so rudely interrupted. Process Control Block (PCB) – information needed to save and restore a process. Process stare (running, waiting, ready) Process identifier (PID) Program counter Other CPU registers CPU scheduling information Memory-management information Accounting information I/O status information In many Unix systems, the PCB is divided between two structures: The proc structure, which holds the process information needed at all times, even when the process is not active (swapped out). The user structure, which holds other information about the process. Historically, it was important to keep as much in the user structure and as little in the proc structure as possible, because of memory constraints. As memory has gotten larger, this has become less important. In FreeBSD, for example, most of the information is now in the proc structure. We can see it on your favorite FreeBSD system in /usr/src/sys/sys/proc.h . See struct proc to see the structure at line 495. 2
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

processes - Computer Science 322 Operating Systems Mount...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online