cs33_os_basics

cs33_os_basics - Some OS Basics Some OS Basics

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

View Full Document Right Arrow Icon
ome OS Basics Some OS Basics Some notes adopted from Bryant and O’Hallaron
Background image of page 1

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

View Full DocumentRight Arrow Icon
Role of The Operating System?
Background image of page 2
Processes •De f : A process is an instance of a running program. –One of the most profound ideas in computer science. – Not the same as “program” or “processor” •P ro ce s s provides each program with two key abstractions: – Logical control flow •Each program seems to have exclusive use of the CPU. rivate address space Private address space •Each program seems to have exclusive use of main memory. •How are these Illusions maintained? – Process executions interleaved (multitasking) – Address spaces managed by virtual memory system
Background image of page 3

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

View Full DocumentRight Arrow Icon
Logical Control Flows Each process has its own logical control flow Process A Process B Process C Time
Background image of page 4
Concurrent Processes •Two processes run concurrently ( are concurrent) if their flows overlap in time. • Otherwise, they are sequential. amples: Examples: – Concurrent: A & B, A & C quential: B & C – Sequential: B & C Process A Process B Process C Time
Background image of page 5

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

View Full DocumentRight Arrow Icon
User View of Concurrent Processes • Control flows for concurrent processes are physically disjoint in time. • However, we can think of concurrent processes are running in parallel with each other. ime Process A Process B Process C Time
Background image of page 6
Context Switching •P ro ce s se s are managed by a shared chunk of OS code called the kernel • Control flow passes from one process to another via a context switch. rocess A rocess B Process A code Process B code user code ontext switch kernel code user code ernel code Time context switch context switch kernel code user code
Background image of page 7

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

View Full DocumentRight Arrow Icon
Process: Traditional View •Process = process context + code, data, and stack Program context: Code, data, and stack stack P Process context shared libraries n me heap Data registers Condition codes Stack pointer (SP) Program counter (PC) SP brk run time heap read/write data read only code/data PC Kernel context: VM structures Descriptor table 0 brk pointer
Background image of page 8
Process: Alternative View •Process = thread + code, data, and kernel context shared libraries Program context: Data registers Code, data, and kernel context Thread run time heap read/write data g Condition codes Stack pointer (SP) Program counter (PC) read only code/data PC brk 0 stack SP Kernel context: VM structures Descriptor table brk pointer
Background image of page 9

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

View Full DocumentRight Arrow Icon
Process with Two Threads Program context: d dt d kl tt Thread 1 shared libraries n me heap Data registers Condition codes Stack pointer (SP) Program counter (PC) Code, data, and kernel context brk run time heap read/write data read only code/data stack SP PC 0 Kernel context: VM structures Program context: ata registers Thread 2 Descriptor table brk pointer Data registers Condition codes Stack pointer (SP) Program counter (PC) stack SP
Background image of page 10