COMP 3430 Operating Systems
IPC – signals
February 7th, 2022
Copyright By PowCoder代写 加微信 powcoder
Beating pools to death.
Thread pools are used extensively in the kernel.
Optional reading: Concurrency-managed workqueues
Us and thread pools.
Announcements
▶ In person/remote ▶ Labs this week
By the end of today’s lecture (and readings), you should be able to:
▶ Describe and solve issues with threads using locks.
▶ Describe different strategies for IPC (signals).
▶ Write a UNIX program that sends and handles signals.
The Rocket Book (Public Domain)
Problems with threads
Threads can be tricky. Let’s take a look at some code that has problems and identify the problems.
1. thread_clobber.c 2. thread_clobber2.c 3. thread_clobber3.c
▶ A primitive method for communication among processes.
▶ Idea: We want to do something when some event happens.
Traffic signals (Pixabay License)
Signal steps
1. Process expresses interest to the kernel in observing that event.
▶ Indicates what code should be executed.
2. Different process sends an event notification. 3. Kernel checks if anyone has expressed interest
▶ If interest was expressed, calls the function.
Signals, in code
Let’s look at fork-signal.c and answer some questions:
▶ Summarize what you expect the output to look like.
▶ When do statements get printed?
▶ What does the overall output look like?
▶ What does the parent process do? ▶ What does the child process do?
▶ Statement non-atomicity is solved with locks.
▶ Locks can and do cause performance problems!
▶ Signals are an IPC mechanism.
▶ Primitive (no messages!)
▶ Useful for events.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com