Prelim 1 - ProcessChp3 Process: Aprograminexecution...

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

View Full Document Right Arrow Icon
Process Chp 3 18:20 Process: A program in execution The unit of work Single thread of control / multiple threads of control Contains Code of running program Data of running program Stack PC Process state Registers Other system resources Process state: New: process is being created Ready: process is waiting to be assigned to a processor Running (only one process) Waiting Terminated Process control block: Process state
Background image of page 1

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

View Full DocumentRight Arrow Icon
Program counter CPU registers Scheduling information Memory management information Accounting information I/O status information Process switch: Run -> interrupt -> save state to PCB -> idle -> Other process runs -> other process interrupted -> other process saves state -> idle ->  switch back to the first process Process scheduling Ready queue Device queues (waiting queues) A process Ready queue Dispatched Events I/O request -> put on I/O queue Create a sub-process and wait until its done Forcibly removed from CPU Back to ready queue Terminate -> removed from all queues and PCB is deallocated
Background image of page 2
Schedulers: More processed are submitted than executed immediately. They are saved in disk. Long-term scheduler Selects and loads processes into memory Less frequently Controls the degree of multiprogramming (the number of processes in the memory) Only invoked when a process leaves the system, so long term scheduler can afford  longer deciding time Needs to select a good mix of I/O bound processes and CPU bound processes Short-term scheduler  Selects one from ready queue and allocate CPU for it More frequently Medium-term scheduler Swapping (adjust degree of multiprogramming) Context switch Save and restore state Process creation Process identifier Parent process creates children Initial data can be passed Children obtain resources Directly from OS
Background image of page 3

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

View Full DocumentRight Arrow Icon
Constraint to subset of parent’s resource Execution Parent and children execute concurrently Parent waits until some or all children completes Address space Duplicate copy New program fork() fork() returns nonzero pid to parent return zero to child but parent and children share everything… exec() replace the memory space of the calling process with a new program in this way, two processes are able to communicate and then go separate ways exit() can return value to parent deallocate all resources cascading termination Inter-process communication shared memory message passing Skip from page 18
Background image of page 4
Thread Chp 4 18:20 Thread:
Background image of page 5

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

View Full DocumentRight Arrow Icon
Thread Chp 4 18:20 Owns:  A thread ID A program counter A register set A stack Shares:  Process code section Data section
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 17

Prelim 1 - ProcessChp3 Process: Aprograminexecution...

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

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