Understanding Operating Systems: From Batch Processing to Multiprogramming
What is an Operating System?
An Operating System (OS) is software that manages and controls all the resources of a computer system holistically.
The First Operating Systems
- No operating system was available. Operation was done manually through the console.
- Programs were written, and the execution start address was specified.
- Magnetic tapes or punch cards were used.
- The console allowed monitoring of program implementation, and users had access to memory registers to identify program errors.
- Results were given in continuous form or on cards.
- The computer was assigned to users in blocks of time.
- Inadequate allocation of time blocks led to setup time issues.
Simple Batch Processing
Execution steps are repeated due to normal compilation errors in batch processes. So, what happens to processes of the same nature? Batch processing also presents problems in optimal CPU utilization, such as stopping processes and idle time. This led to the creation of an automatic sequencer and the first operating system, known as the Resident Monitor.
Offline Operation
Offline operation incorporates magnetic tape media to balance response times. A computer called a satellite enables interaction between card devices and tape drives, providing an upgrade. The disadvantage is the presence of a system with “sequential access”.
Features of Spooling
- Spooling keeps an image of the card on the hard drive once it is read.
- Its essence is the use of the disk as a large buffer memory for reading and partially outputting records to terminate processes.
- An important advantage is that it allows parallel I/O of one job with the processing of another.
- Spooling provides a new data structure: a series of jobs.
- This process is called Processed Scheduling.
- The importance of Processed Scheduling lies in the potential for multiprogramming.
Multiprogramming
The goal of multiprogramming is to ensure the CPU always has a job. This requires more memory for resident programs at the same time.
Concepts of Multiprogramming
Multiprogramming allows several programs to remain in memory simultaneously so they can share the CPU. The benefits of multiprogramming are increased CPU utilization and higher productivity (throughput).
Productivity is the amount of work done in a given time interval.
Classification of Works
- I/O-bound jobs: These have many I/O cycles, and they are small.
- CPU-bound jobs: These have many large cycles in which the program is assigned to the CPU.
In general, there should be a good mixture of both I/O-bound and CPU-bound jobs ready for execution.
Process
A process is a running program, a batch job, a user program in time-sharing, or a system task. In general, the term “process” applies to a running program that can be a job of a very different nature.
Process Control Block
Each process is represented in the operating system by its own Process Control Block (PCB). A PCB is a data structure that contains much of the information associated with a specific process, including:
- The ID of the process
- The process status: This can be new, ready, running, waiting, or detained.
- The program counter: This indicates the address of the next instruction to be executed.
- Fields to store the CPU register: Parallel to the program counter, this state information must be saved during an interruption to allow the process to continue correctly.
Ready Queue of Processes
Processes that are ready and waiting to run are kept in a list called the “ready queue of processes”. This is generally a linked list formed by the PCBs of the processes in this queue. A queue header contains pointers to the first and last PCB on the list. Each PCB has a pointer field that points to the next PCB in the ready queue.
Long-Term Planning (Long-Term Scheduler)
The Long-Term Scheduler (LT-S) determines which jobs are admitted into the system for processing. This is because there are more jobs willing than can be executed immediately. It runs much less frequently. It also controls the degree of multiprogramming (the number of processes in memory). If the degree of multiprogramming is stable, then the average rate of job input to the system must be equal to the average output rate. This makes it possible to invoke the Long-Term Scheduler whenever a job exits the system.
Short-Term Planning (Short-Term Scheduler)
The Short-Term Scheduler (ST-S) chooses between the jobs that are ready for execution and assigns the CPU to one of them. It selects a new process for the CPU frequently. Moreover, given the short time between executions, it must be very fast.