CH 33 OS notes
Even based concurrency – The system waits for an event, checks what type it is, then do the
small amount of work it requires. Event based servers focus on the EVENT LOOP system. The
main loop waits for a process and then for each process it goes through them one at a time. The
code that goes through them is known as the EVENT HANDLER.
The importance of SELECT and POLL commands-
Both check whether an I/O process has come in but they do it in different ways
Select process it by making sure the process passes all the checks, so if it passes read write and
error then it is attended to
Synchronous and Asynchronous blocks
Synchro gets the job done all at once before delivering
Asynchro gets a portion done before delivering
If timeout is set to null then select could block out indefinitely
TIP: DON’T BLOCK IN EVENT-BASED SERVERS Event-based servers enable fine-grained
control over scheduling of tasks. However, to maintain such control, no call that blocks the
execution of the caller can ever be made; failing to obey this design tip will result in a blocked
event-based server, frustrated clients.
Event systems – Events that can block must not be used or it would block the entire server
asynchronous I/O. These interfaces enable an application to issue an I/O request and return
control immediately to the caller, before the I/O has completed.
Asynchronous read – API that reads an async call
UNIX signals can be used to alert if an A i/o call has been completed and prevent repeated
asking
Both the open() and read() calls may issue I/O requests to the storage system
This natural overlap is what makes threading so appealing
Many systems now use the Asynch I/O to overcome the limitations of event loops and prevent
blocking
When it comes to threads the state needed for a program is on the stack of the thread this is
called manual stack management,
UNIX uses signals and has its own signal handler with names like hang up interrupt and
segmentation violation.
Kernels can send signals as well
When a signal is sent to something that can not read signal it automatically results in a default
action which is more than likely to kill the program
Continuation - basically, record the needed information to finish processing this event in some
data structure; when the event happens (i.e., when the disk I/O completes), look up the needed
information and process the event.