UNIX Signals

Shell Backgrounding

Interesting uses of open/read/write/close


Figure on process address space: code, static data, stack, heap. On fork, the whole address space gets replicated. On thread create, the created thread has a different program counter, registers, and stack (through stack pointer). Everything else is shared between threads.

Kernel-level threads are just processes minus separate address spaces. Discuss the kernel scheduler which is invoked at every timer interrupt. Each thread is an independent entity for the kernel.

Write the cswitch function for processes and threads. Notice that switching among threads requires no privileged operations. Switching the stack can be done by switching the sp register. A cswitch needs to be fast (typically a few 100 microseconds).

Advantages of threads over processes

User-level threads can be implemented inside a process by writing scheduler() and cswitch() functions. The scheduler can be called periodically using SIGALRM signal.

Pros of user-level threads:

Cons of user-level threads:

Threading models (slide)