The Implementation of Semaphores

Most contemporary computer architectures offer hardware support for process synchronization in the form of specialized machine instructions. The test-and-set instruction (TS) copies a variable into a register and sets the variable to zero in one indivisible machine cycle. Test-and-set has the form TS(R, x) where R is a register and x is a memory location and performs…

Semaphores

The software solution presented before only works if there is two processes competing for the same code block. Likewise, it is not real efficient if it needs to be used a lot. Semaphores are general-purpose primitives that allow solving a variety of synchronization problems in a systematic manner. A semaphore is a non-negative integer variable that…

Process Interactions

Concurrency is when multiple processes (or threads) execute at the same time. When multiple physical CPUs are available, the processes may execute in parallel. On a single CPU, concurrency may be achieved by time-sharing. There is a whole study in the process of parallel programming, where you design applications to run on multiple processors simultaneously to…

Combined Approaches

If you work with a system that only has batch processes, or only does real time applications, then your scheduling algorithm selection is much easier. You pick an appropriate choice and go with it… However, the modern desktop OS will often include a combination of batch, interactive, and real-time applications. Therefore picking “a” solution isn’t…

Scheduling Real-Time Processes

A real-time process is characterized by continual input, which must be processed fast enough to generate nearly instantaneous output. Each arriving input item is subject to a deadline. Ex: Streaming of audio or video, processing and displaying radar data, control of robots or of fly-by-wire aircraft. A period is a time interval (typically in milliseconds or even microseconds for…

Scheduling of Interactive Processes

An interactive process communicates with the user by receiving commands or data from the keyboard or a pointing device and responding by generating output to an output device. (monitor, printer, etc) A time quantum, Q, is a small amount of time (typically 10 to 100 milliseconds) during which a process is allowed to use the CPU. The round-robin (RR)…

Scheduling of Batch Processes

A batch process performs a long-running and generally repetitive task that does not require any intervention from the user. Ex: Payroll, insurance claims processing, weather prediction, scientific calculations. These are typically run on a server and not a desktop user machine. The FIFO (First-In-First-Out) algorithm, also known as FCFS (First-Come-First-Serve), schedules processes strictly according to the process arrival…