ECE344-Lecture7-Threads - Lecture 7: Threads David Lie...

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

View Full Document Right Arrow Icon
1 Lecture 7: Threads David Lie ECE344 University of Toronto
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 ECE344: Operating Systems Overview Separate OS thread vs Current thread design Kernel threads vs. user threads
Background image of page 2
3 ECE344: Operating Systems Does OS have its Own Thread State? Programs have thread state – Allows stopping and resuming them Does the OS have its own thread state? – Who manages its state when it is not running? Two options – Run OS code using separate thread – Run OS code using current thread
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 ECE344: Operating Systems Run OS Using Separate Thread OS thread runs in privileged mode Uses a single stack for OS code Context switch occurs on each entry into the kernel – Can be expensive – OS runs in a separate address space so switching threads also means switching memory mappings: • Requires TLB flush • Changing active page tables – Simplifies modularity though as threads either perform user actions or kernel actions but never both
Background image of page 4
5 ECE344: Operating Systems Run OS Using Current Thread OS uses current thread in privileged mode This approach is more efficient because a mode switch does not require memory context switch to kernel thread each time – OS161 is implemented this way (and so is Linux) Each thread has two stacks
Background image of page 5

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

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

This document was uploaded on 02/20/2012.

Page1 / 14

ECE344-Lecture7-Threads - Lecture 7: Threads David Lie...

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

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