


































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



































15-410, F'
Dave Eckhardt
Dave Eckhardt
Todd Mowry
Todd Mowry
L07_Thread
“Real concurrency – in which one program actually
continues to function while you call up and use
another – is more amazing but of small use to the
average person. How many programs do you have
that take more than a few seconds to perform any
task?” – NYT, 4/25/
15-410, F'
Partner sign-up
Partner sign-up
Looks like we may be done!
Though somebody may drop during P
Project 1
Project 1
By end of Wednesday...
Console (output) should be “doing something”, “not far”
Should have “some progress” for kbd, timer
»
Should really have at least “solid design”
»
Better to have handled one interrupt once
Write good code
Write good code
Console driver will be used (and extended) in P
15-410, F'
Textbook chapters
Textbook chapters
OSC
Already: Chapters 1 through 3
Today: Chapter 4 (roughly)
Soon: Chapters 6 & 7
»
Transactions (6.9) will be deferred
OS:P+P
Already: Chapters 1 through 3
Today: Chapter 4 (roughly/partly)
Soon: Chapter 6
Remember: reading schedule is on the “schedule” page
15-410, F'
Some of you are going to grad. school
Some of you are going to grad. school
Some of you are wondering about grad. school
Some of you are wondering about grad. school
Some of you are
Some of you are in
in grad. school
grad. school
You should be able to read a Ph.D. dissertation
More generally
More generally
Looking at something in depth is different
Not like a textbook
15-410, F'
Read the “handout”
Read the “handout”
Browse the already-approved list
Browse the already-approved list
Pick something (soon)
Pick something (soon)
“Don't make me stop the car...”
Read a bit before you sleep at night
Read a bit before you sleep at night
or: before you sleep in the morning
and/or: Thanksgiving break / Spring break
Assignment recommended by previous OS students!
Assignment recommended by previous OS students!
They recommend starting early, too
15-410, F'
Thread lecture
Thread lecture
Synchronization lectures
Synchronization lectures
Probably three
Yield lecture
Yield lecture
This is important
This is important
When you leave here, you will use threads
Understanding threads will help you understand the
kernel
Please make sure you
Please make sure you understand
understand threads
threads
We'll try to help by assigning you P
15-410, F'
15-410, F'
15-410, F'
Shared access to data structures
Shared access to data structures
Responsiveness
Responsiveness
Speedup on multiprocessors
Speedup on multiprocessors
15-410, F'
Database server for multiple bank branches
Database server for multiple bank branches
Verify multiple rules are followed
Account balance
Daily withdrawal limit
Multi-account operations (transfer)
Many accesses, each modifies tiny fraction of database
Server for a multi-player game
Server for a multi-player game
Many players
Access (& update) shared world state
Scan multiple objects
Update one or two objects
15-410, F'
Thread
Thread per player
per player
Game objects inside single memory address space
Each thread can access & update game objects
Shared access to OS objects (files)
Thread-switch is cheap
Thread-switch is cheap
Store N registers
Load N registers
15-410, F'
Cancel” button vs. decompressing large JPEG
Cancel” button vs. decompressing large JPEG
Handle mouse click during 10-second process
Map (x,y) to “cancel button” area
Change color / animate shadow / squeak / ...
Verify that button-release happens in button area of screen
...without JPEG decompressor understanding clicks
Actually stopping the decompressor is a separate issue
Threads allow the user to register intent while it's running
15-410, F'
User-space (N:1)
User-space (N:1)
Kernel threads (1:1)
Kernel threads (1:1)
Many-to-many (M :N)
Many-to-many (M :N)
15-410, F'
Internal threading
Internal threading
Thread library adds
threads to a process
Thread switch “just
swaps registers”
Small piece of asm code
Maybe called yield()