19/09/2008. Microkernel Construction. IPC - Implementation. IPC Importance. General IPC Algorithm. IPC Implementation. Short IPC

Size: px
Start display at page:

Download "19/09/2008. Microkernel Construction. IPC - Implementation. IPC Importance. General IPC Algorithm. IPC Implementation. Short IPC"

Transcription

1 IPC Importance Microkernel Construction IPC Implementation General IPC Algorithm Validate parameters Locate target thread if unavailable, deal with it Transfer message untyped - short IPC typed message - long IPC Schedule target thread switch address space as necessary Wait for IPC IPC - Implementation Short IPC Short IPC (uniprocessor) Short IPC (uniprocessor) call system-call preamble (disable intr) identify dest thread and check same chief / no ipc redirection? -to-receive? analyze msg and transfer short: no action required switch to dest thread & address space system-call postamble running wait to receive system-call pre (disable intr) identify dest thread and check same chief / no ipc redirection? -to-receive? analyze msg and transfer short: no action required switch to dest thread & address space system-call post wait to receive running The critical path 1

2 Short IPC (uniprocessor) send (eagerly) Short IPC (uniprocessor) send (lazily) system-call pre (disable intr) system-call pre (disable intr) identify dest thread and check identify dest thread and check same chief / no ipc redirection? same chief / no ipc redirection? -to-receive? -to-receive? running analyze msg and transfer wait to receive running analyze msg and transfer wait to receive short: no action required short: no action required switch to dest thread & address space switch to dest thread & address space running system-call post running running system-call post running IPC IPC EAX EAX ECX ECX EDX EDX EBX EBX ESI ESI EDI EDI EBP EBP ESP ESP EFLAGS EFLAGS EIP EIP CS ES CS ES SS FS SS FS DS GS DS GS IPC IPC EAX EAX ECX ECX EDX EDX EBX EBX ESI ESI EDI EDI EBP EBP ESP ESP EFLAGS EFLAGS EIP EIP CS ES CS ES SS FS SS FS DS GS DS GS 2

3 IPC IPC EAX ECX EDX EBX ESI EDI EBP ESP EAX ECX EDX EBX ESI EDI EBP ESP EFLAGS EIP EFLAGS EIP CS ES CS ES SS FS SS FS DS GS DS GS IPC Implementation Goal Note payload from green thread EAX ECX EDX EBX ESI EDI EBP ESP EFLAGS EIP CS ES SS FS DS GS Most frequent kernel op: short IPC thousands of invocations per second Performance is critical: structure IPC for speed structure entire kernel to support fast IPC What affects performance? cache line misses TLB misses memory references pipe stalls and flushes instruction scheduling Fast Path IPC Attributes for Fast Path Optimize for common cases write in assembler non-critical paths written in C++ but still fast as possible Avoid high-level language overhead: function call state preservation poor code optimizations We want every cycle possible! untyped message single runnable thread after IPC must be valid IPC call switch threads, originator blocks send phase: the target is waiting receive phase: the sender is not to couple, causing us to block no receive timeout 3

4 Avoid Memory References!!! Memory references are slow avoid in IPC: ex: use lazy scheduling avoid in common case: ex: timeouts Optimized Memory stack Also: hard-wire TLB entries for kernel code and data. Microkernel should minimize indirect costs cache pollution Single TLB entry. TLB pollution memory bus thread state UTCB cpu ID thread ID TCB state, grouped by cache lines. TLB Problem Avoid Table Lookups stack stack stack stack Walking a linked has a TLB footprint. thread ID thread no version virtual TCB area virtual TCB area TCB = TCB_area + (thread_no & TCB_size_mask) virtual addresses Validate Thread ID Branch Elimination Common case: -1 thread ID thread no version virtual TCB area slow = ~receiver->thread_state + (timeouts & 0xffff) + sender->resources + receiver->resources; if( slow ) enter_slow_path() Are the thread IDs equal? Reduces branch prediction foot print. Avoids mispredicts & stalls & flushes. Increases ncy for slow path Common case: 0 4

5 TCB Resources Message Transfer Resources bitfield 1 1 One bit per resource Fast path checks entire word if not 0, jump to resource handlers IBM PowerPC 750, 500 MHz, 32 registers Copy area Debug registers up to 10 physical registers virtual register copy loop Many cycles wasted on pipe flushes for privileged instructions. Slow Path vs. Fast Path Inter vs. Intra Address Space L4Ka::Pistachio IPC performance Pentium 3 L4Ka::Pistachio IPC performance Pentium cycles 300 Inter C-Path cycles Inter FastPath 200 Intra FastPath Inter FastPath number message registers number message registers IPC - Implementation Long IPC (uniprocessor) system-call preamble (disable intr) identify dest thread and check same chief -to-receive? analyze msg and transfer long/map: Preemptions possible! (end of timeslice, device interrupt ) Pagefaults possible! (in source and dest address space) Long IPC transfer message switch to dest thread & address space system-call postamble 5

6 Long IPC (uniprocessor) system-call pre (disable intr) identify dest thread and check same chief -to-receive? analyze msg and transfer long/map: lock both partners transfer message unlock both partners switch to dest thread & address space system-call post Preemptions possible! (end of timeslice, device interrupt ) Pagefaults possible! (in source and dest address space) Long IPC (uniprocessor) system-call pre (disable intr) identify dest thread and check same chief -to-receive? analyze msg and transfer long/map: lock both partners enable intr transfer message disable intr unlock both partners switch to dest thread & address space system-call post Preemptions possible! (end of timeslice, device interrupt ) Pagefaults possible! (in source and dest address space) Long IPC (uniprocessor) IPC - mem copy running system-call pre (disable intr) identify dest thread and check same chief -to-receive? wait Why is it needed? Why not share? Security analyze msg and transfer Need own copy long/map: Granularity locked running lock both partners enable intr locked wait Object small than a page or not aligned transfer message disable intr wait to receive unlock both partners switch to dest thread & address space running system-call post copy in - copy out copy in - copy out copy into kernel buffer copy into kernel buffer switch spaces 6

7 copy in - copy out copy into kernel buffer switch spaces copy out of kernel buffer costs for n words 2 2n r/w operations 3 n/8 cache lines 1 n/8 overhead cache misses (small n) 4 n/8 cache misses (large n) select dest area (4+4 M) select dest area (4+4 M) map into source AS (kernel) select dest area (4+4 M) map into source AS (kernel) copy data select dest area (4+4 M) map into source AS (kernel) copy data switch to dest space 7

8 problems multiple threads per AS mappings might change while message is copied How long to keep PTE? What about TLB? current AS invalidate PTE invalidate PTE flush TLB when leaving curr thread during ipc? flush TLB when leaving curr thread during ipc: current AS current AS Reestablishing temp mapping requires to store partner id and dest area address in the sender s tcb. Note: receiver s page mappings might have changed! when returning to thread during ipc: when returning to thread during ipc: current AS current AS 8

9 Start temp mapping: mytcb.partner := partner ; mytcb.waddr := dest 8M area base ; mypde.tmarea := destpde.destarea. optimization only: avoids second TLB flush if subsequent thread switch would flush TLB anyhow current AS Leave thread: if mytcb.waddr nil then mypde.tmarea := nil ; if dest AS = my AS then flush TLB fi fi. Close temp mapping: mytcb.waddr := nil. why? mypde.tmarea := nil?? Alternative method: Requires separation of TLB flush and load PT root! Does therefore not work reasonably on x86. Load PT root implicitly includes TLB flush on x86. current AS Leave thread: if mytcb.waddr nil then mypde.tmarea := nil ; flush TLB ; TLB flushed := true fi. Thread switch : if TLB just flushed then TLB flushed := false else flush TLB fi ; PT root :=... Page Fault Resolution: Page Fault Resolution: current AS current AS Page Fault Resolution: Page Fault Resolution: TM area PF: if mypde.tmarea = destpde.destarea then tunnel to (partner) ; access dest area ; tunnel to (my) fi ; mypde.tmarea := destpde.destarea. current AS current AS 9

10 Cost estimates 486 IPC costs [µs] Mach Copy in - copy out Temporary mapping Mach: copy in/out 400 R/W operations 2 2n 2n L4: temp mapping 300 Cache lines 3 n/8 2 n/8 Small n overhead cache misses n/ L4 + cache flush Large n cache misses Overhead TLB misses 5 n/8 3 n/8 0 n / words per page 100 L4 raw copy Startup instructions msg len Dispatching Dispatching topics: thread switch priorities preemption (to a specific thread) to next thread to be scheduled (to nil) implicitly, when ipc blocks time slices wakeups, interruptions timeouts and wake-ups time Switch to (): Thread A Dispatcher Thread switch to (dispatcher) select next thread, assume B switch to (B) Smaller stack per thread Dispatcher is preemptable Improved interrupt ncy if dispatching is time consuming Thread A Switch to (): tcb[a].sp := SP; SP := disp thread bottom. switch to (dispatcher) switch to (B) Dispatcher Thread select next thread, assume B Optimizations : disp thread is special no user mode, no own AS required Can avoid AS switch no id required Freedom from tcb layout conventions almost stateless (see priorities) No need to preserve internal state between invocations External state must be consistent costs (A B) costs (A disp B) costs (select next) costs( A disp A) are low Thread B Thread B SP := tcb[a].sp ; if B A then switch from A to B else return fi. Why?? 10

11 Switch to (): tcb[a].sp := SP; SP := disp thread bottom. Example: Simple Dispatch Thread A Dispatcher Thread switch to (dispatcher) select next thread, assume B Issue: If preempted, thread A is not in a good state whenever disp thread is left, stack has to be discarded! even if with intr or timer switch to (B) Thread B SP := tcb[a].sp ; if B A then switch from A to B else return fi. Why does this always work? Example: Simple Dispatch Example: Dispatch with Tick sp tcb B edi eax Local State x eip cs flg esp ss tcb A edi eax Local State x eip cs flg esp ss Dispatcher stack Local Variables Example: Dispatch with Tick Example: Dispatch with Tick sp sp tcb B edi eax Local State x eip cs flg esp ss tcb B edi eax Local State x eip cs flg esp ss tcb A Local State x eip cs flg esp ss tcb A edi eax Local State x eip cs flg esp ss Dispatcher Local stack State x eip cs flg esp ss Local Variables Dispatcher stack Local Variables 11

12 Example: Dispatch with Interrupt Example: Dispatch with Interrupt sp Int Thrd edi eax Local State x eip cs flg esp ss tcb A Local State x eip cs flg esp ss Dispatcher Local stack State x eip cs flg esp ss Local Variables Example: Dispatch with Interrupt Switch to (): dispatcher thread is also idle thread Thread A sp Int Thrd tcb A edi eax edi eax Local State Local State x x eip cs flg esp ss eip cs flg esp ss Dispatcher Thread switch to (dispatcher) select next thread, assume B switch to (B) Thread B B := A ; do B:= next (B) ; if B nil then return fi ; idle od. Dispatcher stack Priorities 0 (lowest) 255 hard priorities round robin per prio dynamically changeable tcb per prio current tcb per Optimization Priorities keep highest active prio do p := 255; do if current [p] nil then B := current [p] ; return fi ; p -= 1 until p < 0 od ; idle od. disp table Prio 50 do do p := 255; if current do [highest active p] nil then B := current if current [p] nil [highest active p] ; return then B := current [p] ; elif highest active p > 0 return then highest active p -= 1 fi ; else p -= 1 idle until p < 0 od ; fi idle od. od disp table Prio 50 12

13 Priorities, Preemption highest active p := max (new p, highest active p). Priorities, Preemption What happens when a prio falls empty? do do p := 255; if current do [highest active p] nil then B := current if current [p] nil [highest active p] ; return then B := current [p] ; elif highest active p > 0 return then highest active p -= 1 fi ; else p -= 1 idle until p < 0 od ; fi idle od. od disp table Prio 110 Prio 50 p= 110 intr/wakeup do if current [highest active p] nil then round robin if necessary; B := current [highest active p]; return doelif highest active p > 0 if then current highest active p -= [highest active p] 1 nil else then B := current [highest active p] ; idle fi return od elif. highest active p > 0 then highest active p -= 1 round else robin if necessary: if curr idle [hi act p].rem ts = 0 then curr [hi act p] := next ; fi current [hi act p].rem ts := new ts od fi. disp table Prio 110 Prio 50? Remaining time slice > 0? Priorities, Preemption Preemption What happens when a prio falls empty? Preemption, time slice exhausted do if current [highest active p] nil then round robin if necessary; B := current [highest active p]; return elif highest active p > 0 then highest active p -= 1 else idle fi od. disp table Prio 110 Prio 50 Remaining time slice > 0 do if current [highest active p] nil then round robin if necessary; B := current [highest active p]; return elif highest active p > 0 then highest active p -= 1 else idle fi od. disp table Prio 50 Remaining time slice = 0 round robin if necessary: if curr [hi act p].rem ts = 0 then curr [hi act p] := next ; current [hi act p].rem ts := new ts fi. round robin if necessary: if curr [hi act p].rem ts = 0 then curr [hi act p] := next ; current [hi act p].rem ts := new ts fi. Preemption Lazy Dispatching do if current [highest active p] nil then round robin if necessary; B := current [highest active p]; return elif highest active p > 0 then highest active p -= 1 else idle fi od. Preemption, time slice exhausted disp table Remaining time slice := new ts Prio 50 Thread state toggles frequently (per ipc) waiting delete/insert is expensive therefore: delete lazily from disp table Prio 50 round robin if necessary: if current [hi act p].rem ts = 0 then current [hi act p].rem ts := new ts ; current [hi act p] := next fi. 13

14 Lazy Dispatching Thread state toggles frequently (per ipc) waiting delete/insert is expensive therefore: delete lazily from Lazy Dispatching Thread state toggles frequently (per ipc) waiting delete/insert is expensive therefore: delete lazily from disp table disp table waiting waiting Prio 50 Prio 50 Lazy Dispatching Thread state toggles frequently (per ipc) waiting delete/insert is expensive therefore: delete lazily from disp table Lazy Dispatching Thread state toggles frequently (per ipc) waiting delete/insert is expensive therefore: delete lazily from Whenever reaching a non- thread, delete it from proceed with next disp table waiting Prio 50 Prio 50 Lazy Dispatching Thread state toggles frequently (per ipc) do waiting round robin if necessary; if current [highest delete/insert active p] nil is expensive then B := current therefore: [highest delete active p]; return elif highest active p > 0 lazily from then highest active p -= 1 else idle fi od. disp table Timeouts & Wakeups Operations: insert timeout raise timeout find next timeout delete timeout round robin if necessary: while curr [hi act p] nil do if curr [hi act p].state then delete from (curr [hi act p]) elif curr Prio 50 [hi act p].rem ts = 0 then curr [hi act p].rem ts := new ts else leave round robin if necessary fi ; curr [hi act p] := next ; od. timeout set completion, no timeout timeout expired raised-timeout costs are uncritical (occurr only after timeout exp time) most timeouts are never raised! t 14

15 Timeouts & Wakeups Idea 1: unsorted insert timeout costs: search + insert entry find next timeout costs: parse entire raise timeout costs: delete found entry delete timeout costs: delete entry too expensive cycles n cycles cycles cycles Timeouts & Wakeups too expensive Idea 2: sorted insert timeout costs: search + insert entry n/ cycles find next timeout costs: find head cycles raise timeout costs: delete head cycles delete timeout costs: delete entry cycles Timeouts & Wakeups Idea 3: sorted tree insert timeout costs: search + insert entry find next timeout costs: find head raise timeout costs: delete head delete timeout costs: delete entry too expensive too complicated log n cycles cycles cycles cycles Wakeup Classes Wakeup Classes now insert timeout (now + ) now soon soon now soon t now soon t 15

16 Wakeup Classes now Wakeup Classes now soon soon soon now t soon now t contains soon entries correction phase required contains entries correction phase required Wakeup Classes Timeouts & Wakeups now τ soon soon now soon t max s? (length of soon ) s timeouts to be raised in τ soon + new timeouts in τ soon s is small if τ soon is short enough Idea 4: unsorted wakeup classes insert timeout costs: select class + add entry cycles find next timeout costs: search soon class raise timeout costs: delete head delete timeout costs: delete entry raised-timeout costs are uncritical (occurr only after timeout exp time) BUT most timeouts are never raised! cycles cycles still too expensive s..n cycles Lazy Timeouts Lazy Timeouts insert (t 1 ) insert (t 1 ) delete timeout soon soon t 1 now soon t t 1 now soon t Late Late 16

17 Lazy Timeouts Lazy Sorting insert (t 1 ) delete timeout insert (t 2 ) t 2 soon now soon t Keep a sorted for fast lookup Don t sort on insert insert is common but timeouts are uncommon Sort lazily: sort when walking wakeup thus we sort only when necessary Late Incremental Sorting Combine the cost of sorting with cost of finding first thread to wake Problem: every addition to resets the sorted flag, and thus we must perform entire walk. But we want to avoid this. Alternative: maintain sorted, and unsorted. Merge the two s when necessary. merge can be incremental bubble sort iow: we keep a of new additions, so that we can remove the additions, without requiring a resort Issue How common is insertion compared to wake up searching/sorting? Very IPC more frequent than ticks Wakeup queues always unsorted Approach seems dubious Security Is your system secure? Security defined by policy Examples All users have access to all objects Physical access to servers is forbidden Users only have access to their own files Users have access to their own files, group access files, and public files (UNIX) 17

18 Security policy Specifies who has what type of access to which resources Authentication Authorization All access is via IPC What microkernel mechanisms are needed for security? How do we authenticate? How do we perform authorization? How do we implement arbitrary security policies? How do we enforce arbitrary security policies? Authentication Unforgeable thread identifiers Thread identifiers can be mapped to Tasks Users Groups Machines Domains Authentication is outside the microkernel, any policy can be implemented. Authorization Servers implement objects; clients access objects via IPC. Servers receive unforgeable client identities from the IPC mechanism Servers can implement arbitrary access control policy No special mechanisms needed in the microkernel Is this really true??? Example Policy: Mandatory Access Control Secure System Objects assigned security levels Top Secret, Secret, Classified, Unclassified TS > S > C > UC Subjects (users) assigned security levels Top Secret, Secret, Classified, Unclassified A subject (S) can read an object (O) iff level(s) >= level(o) A subject (S) can write an object (O) iff level(s) <= level(o) Client (UC) S C Server UC TS Client (TS) Client (C) Client (S) 18

19 Problem Conclusion S Server TS To control information flow we must control communication Client (UC) C UC Client (TS) We need mechanisms to not only implement a policy we must also be able to enforce a policy!!! Mechanism should be flexible enough to implement and enforce all relevant security policies. Client (C) Client (S) Clans & Chiefs Clans & Chiefs Within all system based on direct message transfer, protection is essentially a matter of message control. Using access control s can be done at the server level, but maintenance of large distributed access control s becomes hard when access rights change rapidly. The clan concept permits to complement the mentioned passive entity protection by active protection based on intercepting all communication of suspicious subjects. Aclan is a set of tasks headed by achief task. Inside the clan all messages are transferred freely and the kernel guarantees message integrity. But whenever a message tries to cross a clan s borderline, regardless of whether it is outgoing or incoming, it is redirected to the clan s chief. This chief may inspect the message (including the sender and receiver ids as well as the contents) and decide whether or not it should be passed to the destination to which it was addressed. Obviously subject restriction and local reference monitors can be implemented outside the kernel by means of clans. Since chief are tasks at user level, the clan concept allows more sophisticated and user definable checks as well as active control. Clans & Chiefs clan chief A clan is a set of tasks headed by a chief task Intra-Clan IPC clan chief tasks tasks Direct IPC by microkernel 19

20 Inter-Clan IPC clan chief Direction-Preserving Deceiving C 1 C 2 from T 2 T 1 T 2 T 3 T 4 C 3 T5 tasks Microkernel redirects IPC to next chief Chief (user task) can forward IPC or modify or Direction-Preserving Deceiving Direction-Preserving Deceiving C 1 from T 2 C 1 from T 2 C 2 from T 2 from T 2 C 2 from T 2 T 1 T 2 C 3 T 1 T 2 C 3 T 4 T 4 T 3 T5 T 3 T5 Direction-Preserving Deceiving Direction-Preserving Deceiving C 1 from T 2 C 1 from T 2 C 2 from T 2 C 2 Can I trust C from T 2 2? Yes! T 1 T 2 C 3 T 1 T 2 C 3 T 4 T 4 T 3 T5 T 3 T5 20

21 Direction-Preserving Deceiving Direction-Preserving Deceiving C 1 from T 2 C 1 from T 2 C 2 Can I trust C from T 2 2? Yes! C 2 Can I trust C from T 2 1? Yes! T 1 T 2 C 3 T 1 T 2 C 3 T 4 T 4 T 3 T5 T 3 T5 Direction-Preserving Deceiving Example C 1 T 1 T 2 from T 2 T 4 C 2 Can I trust C from T 2 1? Yes! C 3 C 1 T 1 T 2 C 2 Direct-Preserving-Deceiving (DPD) is a simple mechanism to realize security. Imagine the blue task is a tool you have from the Internet. Without DPD there is no relevant security. The blue thread T 3 wants to get some private information from T 1. T 3 T5 T 3 Example Example C 1 T 1 T 2 From T 2 C 2 Direct-Preserving-Deceiving (DPD) is a simple mechanism to realize security. Imagine the blue task is a tool you have from the Internet. Without DPD there is no relevant security. The blue thread T 3 want to get some private information from T 1. The chief C 2 can send an IPC to T 1 so it appears that it came from T 2. C 1 T 1 T 2 From T 2 C 2 Direct-Preserving-Deceiving (DPD) is a simple mechanism to realize security. Imagine the blue task is a tool you have from the Internet. Without DPD there is no relevant security. The blue thread T 3 want to get some private information from T 1. The chief C 2 can send an IPC to T 1 so it appears that it came from T 2. T 3 T 3 The important fact is that with DPD when T 1 gets an IPC from C 2 then he definitely knows that the message came from inside the clan C 2. Vice versa is the same. 21

22 Remote IPC Node A Node B Clans & Chiefs Remote IPC Multi-level security Debugging Heterogeneity Secure System using Clans & Chiefs Problems with Clans & Chiefs S C Server UC TS Chief Client (TS) Client (TS) Static A chief is assigned when task is started If we might want to control IPC, we must always assign a chief General case requires many more IPCs Chief Every task has its own chief Chief Client (UC) Chief Client (C) Client (C) Client (S) Client (S) Client (S) The most general system configuration If a pair could communicate freely we still require 3 IPCs where one would suffice Chief Client Chief IPC Redirection Chief Client Chief Client Client 22

23 IPC Redirection IPC Redirection For each source and destination we actually deliver to X, where X is one of: Destination Intermediary Invalid Intermediary If X is Destination We have a fast path when source and destination can communication freely Source Destination Source Destination IPC fails IPC Redirection If X is Invalid We have a barrier that prevents communication completely IPC Redirection If X is Intermediary Enforce security policy Monitor, analyze, reject, modify each IPC Audit communication Debug Intermediary Source Destination Source Destination IPC fails Deception To be able to transparently insert an intermediary, intermediaries must be able to deceive the destination into believing the intermediary is the source. An intermediary (I) can impersonate a source (S) in IPC to a destination (D) I [S]=> D Iff R(S,D) = I or R(S,D) = x and I[x]=>D Case 1 I[S]=>D if R(S,D) = I Intermediary Source From S Destination 23

24 Case 2 Secure System using IPC Redirection I[S]=>D if R(S,D) = x, and I[x]=>D Redirection Controller S Server TS C UC Intermediary Source X Destination From S Client (UC) Client (C) Client (TS) Client (TS) Client (S) Client (S) Client (S) Client (C) IPC Redirection can implement Clans & Chiefs Disadvantages and Issues Redirection Controller Chief Client (UC) S TS Server C UC Chief Client (C) Client (C) Client (TS) Chief Client (TS) Chief Client (S) Client (S) Client (S) The check for if impersonation is permitted is defined recursively Could be expensive to validate Dynamic insertion of transparent intermediaries is easy, removal is hard. There might be state along a path of intermediaries, redirection controller cannot know unless it has detailed knowledge and/or coordination with intermediaries. Cannot determine IPC path of an impersonated message as path may not exist after message arrives Centralized redirection controller Summary In microkernel based systems information flow is via communication Communication control is necessary to enforce security policy. Any mechanism for communication control must be flexible enough to implement arbitrary security policies. We examined two policy-free mechanisms to provide communication control Clans & Chiefs Redirection Neither is perfect Current research: Virtual Threads, Capabilities 24

µ-kernel Construction (12)

µ-kernel Construction (12) µ-kernel Construction (12) Review 1 Threading Thread state must be saved/restored on thread switch We need a Thread Control Block (TCB) per thread TCBs must be kernel objects TCBs implement threads We

More information

Microkernel Design A walk through selected aspects of

Microkernel Design A walk through selected aspects of Microkernel Design A walk through selected aspects of kernel design and sel4 These slides are made distributed under the Creative Commons Attribution 3.0 License, unless otherwise noted on individual slides.

More information

µ-kernel Construction

µ-kernel Construction µ-kernel Construction Fundamental Abstractions Thread Address Space What is a thread? How to implement? What conclusions can we draw from our analysis with respect to µk construction? A thread of control

More information

IPC Functionality & Interface Universität Karlsruhe, System Architecture Group

IPC Functionality & Interface Universität Karlsruhe, System Architecture Group µ-kernel Construction (4) IPC Functionality & Interface 1 IPC Primitives Send to (a specified thread) Receive from (a specified thread) Two threads communicate No interference from other threads Other

More information

Threads, System Calls, and Thread Switching

Threads, System Calls, and Thread Switching µ-kernel Construction (2) Threads, System Calls, and Thread Switching (updated on 2009-05-08) Review from Last Lecture The 100-µs Disaster 25 MHz 386 50 MHz 486 90 MHz Pentium 133 MHz Alpha 3 C Costs (486,

More information

8/09/2006. µ-kernel Construction. Fundamental Abstractions. Thread Switch A B. Thread Switch A B. user mode A kernel. user mode A

8/09/2006. µ-kernel Construction. Fundamental Abstractions. Thread Switch A B. Thread Switch A B. user mode A kernel. user mode A Fundamental Abstractions µ- Construction Thread Address Space What is a thread? How to implement? What conclusions can we draw from our analysis with rect to µk construction? A thread of control has internal

More information

The Instruction Set. Chapter 5

The Instruction Set. Chapter 5 The Instruction Set Architecture Level(ISA) Chapter 5 1 ISA Level The ISA level l is the interface between the compilers and the hardware. (ISA level code is what a compiler outputs) 2 Memory Models An

More information

µ-kernel Construction

µ-kernel Construction µ-kernel Construction Fundamental Abstractions Thread Address Space What is a thread? How to implement? What conclusions can we draw from our analysis with respect to µk construction? Processor? IP SP

More information

Processes and Tasks What comprises the state of a running program (a process or task)?

Processes and Tasks What comprises the state of a running program (a process or task)? Processes and Tasks What comprises the state of a running program (a process or task)? Microprocessor Address bus Control DRAM OS code and data special caches code/data cache EAXEBP EIP DS EBXESP EFlags

More information

CS533 Concepts of Operating Systems. Jonathan Walpole

CS533 Concepts of Operating Systems. Jonathan Walpole CS533 Concepts of Operating Systems Jonathan Walpole Improving IPC by Kernel Design & The Performance of Micro- Kernel Based Systems The IPC Dilemma IPC is very import in µ-kernel design - Increases modularity,

More information

Lecture Dependable Systems Practical Report Software Implemented Fault Injection. July 31, 2010

Lecture Dependable Systems Practical Report Software Implemented Fault Injection. July 31, 2010 Lecture Dependable Systems Practical Report Software Implemented Fault Injection Paul Römer Frank Zschockelt July 31, 2010 1 Contents 1 Introduction 3 2 Software Stack 3 2.1 The Host and the Virtual Machine.....................

More information

Tutorial 10 Protection Cont.

Tutorial 10 Protection Cont. Tutorial 0 Protection Cont. 2 Privilege Levels Lower number => higher privilege Code can access data of equal/lower privilege levels only Code can call more privileged data via call gates Each level has

More information

Multiprocessor Solution

Multiprocessor Solution Mutual Exclusion Multiprocessor Solution P(sema S) begin while (TAS(S.flag)==1){}; { busy waiting } S.Count= S.Count-1 if (S.Count < 0){ insert_t(s.qwt) BLOCK(S) {inkl.s.flag=0)!!!} } else S.flag =0 end

More information

6x86 PROCESSOR Superscalar, Superpipelined, Sixth-generation, x86 Compatible CPU

6x86 PROCESSOR Superscalar, Superpipelined, Sixth-generation, x86 Compatible CPU 1-6x86 PROCESSOR Superscalar, Superpipelined, Sixth-generation, x86 Compatible CPU Product Overview Introduction 1. ARCHITECTURE OVERVIEW The Cyrix 6x86 CPU is a leader in the sixth generation of high

More information

3. Process Management in xv6

3. Process Management in xv6 Lecture Notes for CS347: Operating Systems Mythili Vutukuru, Department of Computer Science and Engineering, IIT Bombay 3. Process Management in xv6 We begin understanding xv6 process management by looking

More information

MICROPROCESSOR TECHNOLOGY

MICROPROCESSOR TECHNOLOGY MICROPROCESSOR TECHNOLOGY Assis. Prof. Hossam El-Din Moustafa Lecture 5 Ch.2 A Top-Level View of Computer Function (Cont.) 24-Feb-15 1 CPU (CISC & RISC) Intel CISC, Motorola RISC CISC (Complex Instruction

More information

IA32 Intel 32-bit Architecture

IA32 Intel 32-bit Architecture 1 2 IA32 Intel 32-bit Architecture Intel 32-bit Architecture (IA32) 32-bit machine CISC: 32-bit internal and external data bus 32-bit external address bus 8086 general registers extended to 32 bit width

More information

SYSTEM CALL IMPLEMENTATION. CS124 Operating Systems Fall , Lecture 14

SYSTEM CALL IMPLEMENTATION. CS124 Operating Systems Fall , Lecture 14 SYSTEM CALL IMPLEMENTATION CS124 Operating Systems Fall 2017-2018, Lecture 14 2 User Processes and System Calls Previously stated that user applications interact with the kernel via system calls Typically

More information

Chapter 11. Addressing Modes

Chapter 11. Addressing Modes Chapter 11 Addressing Modes 1 2 Chapter 11 11 1 Register addressing mode is the most efficient addressing mode because the operands are in the processor itself (there is no need to access memory). Chapter

More information

Protection and System Calls. Otto J. Anshus

Protection and System Calls. Otto J. Anshus Protection and System Calls Otto J. Anshus Protection Issues CPU protection Prevent a user from using the CPU for too long Throughput of jobs, and response time to events (incl. user interactive response

More information

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź Low Level Programming Lecture 2 Intel processors' architecture reminder Fig. 1. IA32 Registers IA general purpose registers EAX- accumulator, usually used to store results of integer arithmetical or binary

More information

Hardware and Software Architecture. Chapter 2

Hardware and Software Architecture. Chapter 2 Hardware and Software Architecture Chapter 2 1 Basic Components The x86 processor communicates with main memory and I/O devices via buses Data bus for transferring data Address bus for the address of a

More information

The Microprocessor and its Architecture

The Microprocessor and its Architecture The Microprocessor and its Architecture Contents Internal architecture of the Microprocessor: The programmer s model, i.e. The registers model The processor model (organization) Real mode memory addressing

More information

William Stallings Computer Organization and Architecture 10 th Edition Pearson Education, Inc., Hoboken, NJ. All rights reserved.

William Stallings Computer Organization and Architecture 10 th Edition Pearson Education, Inc., Hoboken, NJ. All rights reserved. + William Stallings Computer Organization and Architecture 10 th Edition 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved. 2 + Chapter 14 Processor Structure and Function + Processor Organization

More information

Microkernel Construction

Microkernel Construction Real-Time Scheduling Preemptive Priority-Based Scheduling User assigns each thread a set of scheduling attributes (time quantum, priority) When the current thread s time quantum is exhausted, the kernel

More information

What You Need to Know for Project Three. Dave Eckhardt Steve Muckle

What You Need to Know for Project Three. Dave Eckhardt Steve Muckle What You Need to Know for Project Three Dave Eckhardt Steve Muckle Overview Introduction to the Kernel Project Mundane Details in x86 registers, paging, the life of a memory access, context switching,

More information

UNIT- 5. Chapter 12 Processor Structure and Function

UNIT- 5. Chapter 12 Processor Structure and Function UNIT- 5 Chapter 12 Processor Structure and Function CPU Structure CPU must: Fetch instructions Interpret instructions Fetch data Process data Write data CPU With Systems Bus CPU Internal Structure Registers

More information

Basic Execution Environment

Basic Execution Environment Basic Execution Environment 3 CHAPTER 3 BASIC EXECUTION ENVIRONMENT This chapter describes the basic execution environment of an Intel Architecture processor as seen by assembly-language programmers.

More information

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model SYSC3601 Microprocessor Systems Unit 2: The Intel 8086 Architecture and Programming Model Topics/Reading SYSC3601 2 Microprocessor Systems 1. Registers and internal architecture (Ch 2) 2. Address generation

More information

Complex Instruction Set Computer (CISC)

Complex Instruction Set Computer (CISC) Introduction ti to IA-32 IA-32 Processors Evolutionary design Starting in 1978 with 886 Added more features as time goes on Still support old features, although obsolete Totally dominate computer market

More information

Introduction to IA-32. Jo, Heeseung

Introduction to IA-32. Jo, Heeseung Introduction to IA-32 Jo, Heeseung IA-32 Processors Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1 Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD 21252 rkarne@towson.edu 11/12/2014 Slide 1 Intel x86 Aseembly Language Assembly Language Assembly Language

More information

INTRODUCTION TO IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung INTRODUCTION TO IA-32 Jo, Heeseung IA-32 PROCESSORS Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information

Microkernels. Overview. Required reading: Improving IPC by kernel design

Microkernels. Overview. Required reading: Improving IPC by kernel design Microkernels Required reading: Improving IPC by kernel design Overview This lecture looks at the microkernel organization. In a microkernel, services that a monolithic kernel implements in the kernel are

More information

ICS143A: Principles of Operating Systems. Midterm recap, sample questions. Anton Burtsev February, 2017

ICS143A: Principles of Operating Systems. Midterm recap, sample questions. Anton Burtsev February, 2017 ICS143A: Principles of Operating Systems Midterm recap, sample questions Anton Burtsev February, 2017 Describe the x86 address translation pipeline (draw figure), explain stages. Address translation What

More information

ECE 391 Exam 1 Review Session - Spring Brought to you by HKN

ECE 391 Exam 1 Review Session - Spring Brought to you by HKN ECE 391 Exam 1 Review Session - Spring 2018 Brought to you by HKN DISCLAIMER There is A LOT (like a LOT) of information that can be tested for on the exam, and by the nature of the course you never really

More information

Processor Structure and Function

Processor Structure and Function WEEK 4 + Chapter 14 Processor Structure and Function + Processor Organization Processor Requirements: Fetch instruction The processor reads an instruction from memory (register, cache, main memory) Interpret

More information

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author...xi

More information

Function Calls COS 217. Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site)

Function Calls COS 217. Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site) Function Calls COS 217 Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site) 1 Goals of Today s Lecture Finishing introduction to assembly language o EFLAGS register

More information

Chapter 12. CPU Structure and Function. Yonsei University

Chapter 12. CPU Structure and Function. Yonsei University Chapter 12 CPU Structure and Function Contents Processor organization Register organization Instruction cycle Instruction pipelining The Pentium processor The PowerPC processor 12-2 CPU Structures Processor

More information

Predictable Interrupt Management and Scheduling in the Composite Component-based System

Predictable Interrupt Management and Scheduling in the Composite Component-based System Predictable Interrupt Management and Scheduling in the Composite Component-based System Gabriel Parmer and Richard West Computer Science Department Boston University Boston, MA 02215 {gabep1, richwest}@cs.bu.edu

More information

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University COS 318: Operating Systems Overview Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Announcements Precepts: Tue (Tonight)!

More information

Ausgewählte Betriebssysteme. Anatomy of a system call

Ausgewählte Betriebssysteme. Anatomy of a system call Ausgewählte Betriebssysteme Anatomy of a system call 1 User view #include int main(void) { printf( Hello World!\n ); return 0; } 2 3 Syscall (1) User: write(fd, buffer, sizeof(buffer)); size

More information

History of the Intel 80x86

History of the Intel 80x86 Intel s IA-32 Architecture Cptr280 Dr Curtis Nelson History of the Intel 80x86 1971 - Intel invents the microprocessor, the 4004 1975-8080 introduced 8-bit microprocessor 1978-8086 introduced 16 bit microprocessor

More information

Memory Models. Registers

Memory Models. Registers Memory Models Most machines have a single linear address space at the ISA level, extending from address 0 up to some maximum, often 2 32 1 bytes or 2 64 1 bytes. Some machines have separate address spaces

More information

6.828: Using Virtual Memory. Adam Belay

6.828: Using Virtual Memory. Adam Belay 6.828: Using Virtual Memory Adam Belay abelay@mit.edu 1 Outline Cool things you can do with virtual memory: Lazy page allocation (homework) Better performance/efficiency E.g. One zero-filled page E.g.

More information

Microkernel Construction

Microkernel Construction Kernel Entry / Exit SS2013 Control Transfer Microkernel User Stack A Address Space Kernel Stack A User Stack User Stack B Address Space Kernel Stack B User Stack 1. Kernel Entry (A) 2. Thread Switch (A

More information

19/09/2008. µ-kernel Construction. Fundamental Abstractions. user mode A kernel. user mode A kernel. user mode A kernel. user mode A kernel

19/09/2008. µ-kernel Construction. Fundamental Abstractions. user mode A kernel. user mode A kernel. user mode A kernel. user mode A kernel Fundamental Abstractions µ- Construction Thread Address Space What is a thread? How to implement? What conclusions can we draw from our analysis with rect to µk construction? Processor? A Processor code

More information

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP. Procedures: CALL: Pushes the address of the instruction following the CALL instruction onto the stack. RET: Pops the address. SUM PROC NEAR USES BX CX DX ADD AX, BX ADD AX, CX MOV AX, DX RET SUM ENDP NEAR

More information

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017 CS 471 Operating Systems Yue Cheng George Mason University Fall 2017 Outline o Process concept o Process creation o Process states and scheduling o Preemption and context switch o Inter-process communication

More information

Low-Level Essentials for Understanding Security Problems Aurélien Francillon

Low-Level Essentials for Understanding Security Problems Aurélien Francillon Low-Level Essentials for Understanding Security Problems Aurélien Francillon francill@eurecom.fr Computer Architecture The modern computer architecture is based on Von Neumann Two main parts: CPU (Central

More information

Boot Procedure. BP (boot processor) Start BIOS Firmware Load A2 Bootfile Initialize modules Module Machine Module Heaps

Boot Procedure. BP (boot processor) Start BIOS Firmware Load A2 Bootfile Initialize modules Module Machine Module Heaps Boot rocedure Start BIOS Firmware Load A2 Bootfile Initialize modules Module Machine Module Heaps Module Objects Setup scheduler and self process Module Kernel Start all processors Module Bootconsole read

More information

TCBs and Address-Space Layouts Universität Karlsruhe, System Architecture Group

TCBs and Address-Space Layouts Universität Karlsruhe, System Architecture Group µ-kernel Construction (3) TCBs and Address-Space Layouts 1 Thread Control Blocks (TCBs) 2 Fundamental Abstractions Thread Address space What is a thread? How to implement it? 3 Construction Conclusion

More information

x86 Assembly Tutorial COS 318: Fall 2017

x86 Assembly Tutorial COS 318: Fall 2017 x86 Assembly Tutorial COS 318: Fall 2017 Project 1 Schedule Design Review: Monday 9/25 Sign up for 10-min slot from 3:00pm to 7:00pm Complete set up and answer posted questions (Official) Precept: Monday

More information

+ Overview. Projects: Developing an OS Kernel for x86. ! Handling Intel Processor Exceptions: the Interrupt Descriptor Table (IDT)

+ Overview. Projects: Developing an OS Kernel for x86. ! Handling Intel Processor Exceptions: the Interrupt Descriptor Table (IDT) + Projects: Developing an OS Kernel for x86 Low-Level x86 Programming: Exceptions, Interrupts, and Timers + Overview! Handling Intel Processor Exceptions: the Interrupt Descriptor Table (IDT)! Handling

More information

Operating Systems and Protection CS 217

Operating Systems and Protection CS 217 Operating Systems and Protection CS 7 Goals of Today s Lecture How multiple programs can run at once o es o Context switching o control block o Virtual Boundary between parts of the system o User programs

More information

Introduction to the Process David E. Culler CS162 Operating Systems and Systems Programming Lecture 2 Sept 3, 2014

Introduction to the Process David E. Culler CS162 Operating Systems and Systems Programming Lecture 2 Sept 3, 2014 Introduction to the Process David E. Culler CS162 Operating Systems and Systems Programming Lecture 2 Sept 3, 2014 Reading: A&D CH2.1-7 HW: 0 out, due 9/8 Recall: What is an operating system? Special layer

More information

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Introduction This chapter presents the microprocessor

More information

IA32/Linux Virtual Memory Architecture

IA32/Linux Virtual Memory Architecture IA32/Linux Virtual Memory Architecture Basic Execution Environment Application Programming Registers General-purpose registers 31 0 EAX AH AL EBX BH BL ECX CH CL EDX DH DL EBP ESI EDI BP SI DI Segment

More information

Microkernel Construction

Microkernel Construction Microkernel Construction Kernel Entry / Exit Nils Asmussen 05/04/2017 1 / 45 Outline x86 Details Protection Facilities Interrupts and Exceptions Instructions for Entry/Exit Entering NOVA Leaving NOVA 2

More information

Chapter 2: The Microprocessor and its Architecture

Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Introduction This chapter presents the microprocessor

More information

Systems Architecture I

Systems Architecture I Systems Architecture I Topics Assemblers, Linkers, and Loaders * Alternative Instruction Sets ** *This lecture was derived from material in the text (sec. 3.8-3.9). **This lecture was derived from material

More information

Assembly Language Lab # 9

Assembly Language Lab # 9 Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Assembly Language Lab # 9 Stacks and Subroutines Eng. Doaa Abu Jabal Assembly Language Lab # 9 Stacks and Subroutines

More information

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86 Lecture 15 Intel Manual, Vol. 1, Chapter 3 Hampden-Sydney College Fri, Mar 6, 2009 Outline 1 2 Overview See the reference IA-32 Intel Software Developer s Manual Volume 1: Basic, Chapter 3. Instructions

More information

Scheduling. CS 161: Lecture 4 2/9/17

Scheduling. CS 161: Lecture 4 2/9/17 Scheduling CS 161: Lecture 4 2/9/17 Where does the first process come from? The Linux Boot Process Machine turned on; BIOS runs BIOS: Basic Input/Output System Stored in flash memory on motherboard Determines

More information

Computer Organization & Assembly Language Programming

Computer Organization & Assembly Language Programming Computer Organization & Assembly Language Programming CSE 2312-002 (Fall 2011) Lecture 8 ISA & Data Types & Instruction Formats Junzhou Huang, Ph.D. Department of Computer Science and Engineering Fall

More information

x86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT

x86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT x86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT kaashoek@mit.edu Outline Enforcing modularity with virtualization Virtualize processor and memory x86 mechanism for virtualization

More information

Improved Address-Space Switching on Pentium. Processors by Transparently Multiplexing User. Address Spaces. Jochen Liedtke

Improved Address-Space Switching on Pentium. Processors by Transparently Multiplexing User. Address Spaces. Jochen Liedtke Improved Address-Space Switching on Pentium Processors by Transparently Multiplexing User Address Spaces Jochen Liedtke GMD German National Research Center for Information Technology jochen.liedtkegmd.de

More information

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II) MICROPROCESSOR UOP S.E.COMP (SEM-II) 80386 MICROPROCESSOR ARCHITECTURE Prof. P. C. Patil Department of Computer Engg Sandip Institute of Engineering & Management Nashik pc.patil@siem.org.in 1 Introduction

More information

L4 Nucleus Version X Reference Manual. x86

L4 Nucleus Version X Reference Manual. x86 L4 Nucleus Version X Reference Manual x86 Version X.0 Jochen Liedtke Universität Karlsruhe liedtke@ira.uka.de September 3, 1999 Under Construction How To Read This Manual This reference manual consists

More information

Yielding, General Switching. November Winter Term 2008/2009 Gerd Liefländer Universität Karlsruhe (TH), System Architecture Group

Yielding, General Switching. November Winter Term 2008/2009 Gerd Liefländer Universität Karlsruhe (TH), System Architecture Group System Architecture 6 Switching Yielding, General Switching November 10 2008 Winter Term 2008/2009 Gerd Liefländer 1 Agenda Review & Motivation Switching Mechanisms Cooperative PULT Scheduling + Switch

More information

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 The Operating System (OS) Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke)

More information

Barrelfish Project ETH Zurich. Message Notifications

Barrelfish Project ETH Zurich. Message Notifications Barrelfish Project ETH Zurich Message Notifications Barrelfish Technical Note 9 Barrelfish project 16.06.2010 Systems Group Department of Computer Science ETH Zurich CAB F.79, Universitätstrasse 6, Zurich

More information

238P: Operating Systems. Lecture 5: Address translation. Anton Burtsev January, 2018

238P: Operating Systems. Lecture 5: Address translation. Anton Burtsev January, 2018 238P: Operating Systems Lecture 5: Address translation Anton Burtsev January, 2018 Two programs one memory Very much like car sharing What are we aiming for? Illusion of a private address space Identical

More information

ò Paper reading assigned for next Tuesday ò Understand low-level building blocks of a scheduler User Kernel ò Understand competing policy goals

ò Paper reading assigned for next Tuesday ò Understand low-level building blocks of a scheduler User Kernel ò Understand competing policy goals Housekeeping Paper reading assigned for next Tuesday Scheduling Don Porter CSE 506 Memory Management Logical Diagram Binary Memory Formats Allocators Threads Today s Lecture Switching System to CPU Calls

More information

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM EXPERIMENT WRITE UP AIM: Assembly language program for 16 bit BCD addition LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM TOOLS/SOFTWARE

More information

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam Assembly Language Lecture 2 - x86 Processor Architecture Ahmed Sallam Introduction to the course Outcomes of Lecture 1 Always check the course website Don t forget the deadline rule!! Motivations for studying

More information

Assembler Programming. Lecture 2

Assembler Programming. Lecture 2 Assembler Programming Lecture 2 Lecture 2 8086 family architecture. From 8086 to Pentium4. Registers, flags, memory organization. Logical, physical, effective address. Addressing modes. Processor Processor

More information

Falling in Love with EROS (Or Not) Robert Grimm New York University

Falling in Love with EROS (Or Not) Robert Grimm New York University Falling in Love with EROS (Or Not) Robert Grimm New York University The Three Questions What is the problem? What is new or different? What are the contributions and limitations? Basic Access Control Access

More information

143A: Principles of Operating Systems. Lecture 6: Address translation. Anton Burtsev January, 2017

143A: Principles of Operating Systems. Lecture 6: Address translation. Anton Burtsev January, 2017 143A: Principles of Operating Systems Lecture 6: Address translation Anton Burtsev January, 2017 Address translation Segmentation Descriptor table Descriptor table Base address 0 4 GB Limit

More information

238P: Operating Systems. Lecture 14: Process scheduling

238P: Operating Systems. Lecture 14: Process scheduling 238P: Operating Systems Lecture 14: Process scheduling This lecture is heavily based on the material developed by Don Porter Anton Burtsev November, 2017 Cooperative vs preemptive What is cooperative multitasking?

More information

Project 2: Signals. Consult the submit server for deadline date and time

Project 2: Signals. Consult the submit server for deadline date and time Project 2: Signals Consult the submit server for deadline date and time You will implement the Signal() and Kill() system calls, preserving basic functions of pipe (to permit SIGPIPE) and fork (to permit

More information

Superscalar Processors

Superscalar Processors Superscalar Processors Superscalar Processor Multiple Independent Instruction Pipelines; each with multiple stages Instruction-Level Parallelism determine dependencies between nearby instructions o input

More information

x86 architecture et similia

x86 architecture et similia x86 architecture et similia 1 FREELY INSPIRED FROM CLASS 6.828, MIT A full PC has: PC architecture 2 an x86 CPU with registers, execution unit, and memory management CPU chip pins include address and data

More information

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5) Announcements Reading Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) 1 Relationship between Kernel mod and User Mode User Process Kernel System Calls User Process

More information

2.3. ACTIVITY MANAGEMENT

2.3. ACTIVITY MANAGEMENT 2.3. ACTIVITY MANAGEMENT 204 Life Cycle of Activities Running Awaiting Condition Awaiting Lock NIL Ready Terminated 205 Runtime Data Structures running array global 1 2 3 4 processor id object header object

More information

CSE502: Computer Architecture CSE 502: Computer Architecture

CSE502: Computer Architecture CSE 502: Computer Architecture CSE 502: Computer Architecture Instruction Commit The End of the Road (um Pipe) Commit is typically the last stage of the pipeline Anything an insn. does at this point is irrevocable Only actions following

More information

CSE398: Network Systems Design

CSE398: Network Systems Design CSE398: Network Systems Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University February 23, 2005 Outline

More information

Communicating with People (2.8)

Communicating with People (2.8) Communicating with People (2.8) For communication Use characters and strings Characters 8-bit (one byte) data for ASCII lb $t0, 0($sp) ; load byte Load a byte from memory, placing it in the rightmost 8-bits

More information

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads Today s Topics COS 318: Operating Systems Implementing Threads u Thread implementation l Non-preemptive versus preemptive threads l Kernel vs. user threads Jaswinder Pal Singh and a Fabulous Course Staff

More information

The x86 Architecture

The x86 Architecture The x86 Architecture Lecture 24 Intel Manual, Vol. 1, Chapter 3 Robb T. Koether Hampden-Sydney College Fri, Mar 20, 2015 Robb T. Koether (Hampden-Sydney College) The x86 Architecture Fri, Mar 20, 2015

More information

Assembly Language: Function Calls

Assembly Language: Function Calls Assembly Language: Function Calls 1 Goals of this Lecture Help you learn: Function call problems: Calling and returning Passing parameters Storing local variables Handling registers without interference

More information

Assembly Language. Lecture 2 x86 Processor Architecture

Assembly Language. Lecture 2 x86 Processor Architecture Assembly Language Lecture 2 x86 Processor Architecture Ahmed Sallam Slides based on original lecture slides by Dr. Mahmoud Elgayyar Introduction to the course Outcomes of Lecture 1 Always check the course

More information

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1 Chapter 2 1 MIPS Instructions Instruction Meaning add $s1,$s2,$s3 $s1 = $s2 + $s3 sub $s1,$s2,$s3 $s1 = $s2 $s3 addi $s1,$s2,4 $s1 = $s2 + 4 ori $s1,$s2,4 $s2 = $s2 4 lw $s1,100($s2) $s1 = Memory[$s2+100]

More information

Assembly Language Programming Introduction

Assembly Language Programming Introduction Assembly Language Programming Introduction October 10, 2017 Motto: R7 is used by the processor as its program counter (PC). It is recommended that R7 not be used as a stack pointer. Source: PDP-11 04/34/45/55

More information

Assembly Language: Function Calls" Goals of this Lecture"

Assembly Language: Function Calls Goals of this Lecture Assembly Language: Function Calls" 1 Goals of this Lecture" Help you learn:" Function call problems:" Calling and returning" Passing parameters" Storing local variables" Handling registers without interference"

More information

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable What s An OS? Provides environment for executing programs Process abstraction for multitasking/concurrency scheduling Hardware abstraction layer (device drivers) File systems Communication Do we need an

More information

The x86 Architecture. ICS312 - Spring 2018 Machine-Level and Systems Programming. Henri Casanova

The x86 Architecture. ICS312 - Spring 2018 Machine-Level and Systems Programming. Henri Casanova The x86 Architecture ICS312 - Spring 2018 Machine-Level and Systems Programming Henri Casanova (henric@hawaii.edu) The 80x86 Architecture! To learn assembly programming we need to pick a processor family

More information

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 12 Processor Structure and Function

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 12 Processor Structure and Function William Stallings Computer Organization and Architecture 8 th Edition Chapter 12 Processor Structure and Function CPU Structure CPU must: Fetch instructions Interpret instructions Fetch data Process data

More information

Chapter 8: Virtual Memory. Operating System Concepts

Chapter 8: Virtual Memory. Operating System Concepts Chapter 8: Virtual Memory Silberschatz, Galvin and Gagne 2009 Chapter 8: Virtual Memory Background Demand Paging Copy-on-Write Page Replacement Allocation of Frames Thrashing Memory-Mapped Files Allocating

More information