cs552-s10-processes_and_threads

cs552-s10-processes_and_threads - Processes and Threads...

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

View Full Document Right Arrow Icon
Click to edit Master subtitle style 1/20/11 Processes and Threads Operating Systems CS 552 Spring 2010 Kenneth Chiu
Background image of page 1

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

View Full DocumentRight Arrow Icon
1/20/11 processes
Background image of page 2
1/20/11 The Process Model A process is just an instance of a running program. Can be thought of as the fundamental unit of resource Four logical program counters
Background image of page 3

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

View Full DocumentRight Arrow Icon
1/20/11 Suppose you are writing a program, maybe a game. You need to pause for 1/ 10 of a second. Can you write a loop like this to create that pause? for (int i = 0; i < 1000000; i++); Programs can’t use CPU loops for timing: for (int i = 0; i < 1000000; i++); Doesn’t work, since the process may get
Background image of page 4
1/20/11 Process Creation Four principle events which cause process creation: 1. System initialization. Many of these are daemons (services). 2. Execution of a process creation system call by a running process. 3. A user request to create a new process. 4. Initiation of a batch job.
Background image of page 5

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

View Full DocumentRight Arrow Icon
1/20/11 Process Termination Events which cause process termination: Normal exit (voluntary). Error exit (voluntary). Fatal error (involuntary). Killed by another process (involuntary).
Background image of page 6
1/20/11 Process Hierarchies Each process in UNIX has exactly one parent. A process may have multiple children. A subtree in the hierarchy is a process group. Some signals propagate to the whole group.
Background image of page 7

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

View Full DocumentRight Arrow Icon
1/20/11 Process States Why might a process not be running? What states can it be in? A process may not be running for two very different reason. A process may be not running because it is waiting for input.
Background image of page 8
1/20/11 A process may be in three states (simplified): 1. Running (actually using the CPU at that instant). 2. Ready (runnable; temporarily stopped to let another process run). 3. Blocked (unable to run until some external event occurs).
Background image of page 9

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

View Full DocumentRight Arrow Icon
1/20/11 Processes are controlled by scheduler. Interrupts of course will interact with scheduler, but hidden from processes.
Background image of page 10
1/20/11 Implementation of Processes Process table has one entry per process.
Background image of page 11

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

View Full DocumentRight Arrow Icon
1/20/11 Interrupt are serviced in a such that it is transparent to the process.
Background image of page 12
1/20/11 The Benefit of Multiprogramming Does multiprogramming ever improve performance? Degree of multiprogramming
Background image of page 13

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

View Full DocumentRight Arrow Icon
1/20/11 threads
Background image of page 14
1/20/11 Motivation Traditionally, a process is one address space and one thread of control. Why would you ever want multiple threads in one process? In many applications, multiple things are going at the same time. Receiving from a server.
Background image of page 15

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

View Full DocumentRight Arrow Icon
1/20/11 Word processing example Suppose you have a 100 page document. You type one character on the first page. What kind of computation has to happen? That causes all pages to be reformatted.
Background image of page 16
Web server: Dispatcher reads requests, hands off. Worker thread checks cache, if not
Background image of page 17

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

View Full DocumentRight Arrow Icon
Image of page 18
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 92

cs552-s10-processes_and_threads - Processes and Threads...

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

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