Timesharing Operating System
- Timesharing refers to the allocation of computer resources in a time dependent fashion to several programs simultaneously.
- A timesharing system has many user terminals that are connected to same computer simultaneously. Using these terminal, different users can work on a system at the same time.
- Thus, it uses multiprogramming with a special CPU scheduling algorithm to achieve this. In timesharing system, the CPU time is divided among all the users on a scheduled basis.
- Each user program is allocated a very short period of CPU time one-by-one, beginning from the first user program and proceeding the last one, and then again beginning from the first one.
- This short period of time during which user gets the attention of the CPU is known as a time slice, time slot or quantum. It is typically of the order of 10 to 100 milliseconds.
- Thus, in timesharing, when the CPU is allocated to a user program, the user uses the CPU for the period of time slot.
It releases the CPU under any of the following three conditions :
- When the allotted time slice expires.
- When the program needs to perform 1/O operation
- When the execution of the program is over during the time slice.
- Even though it may appear that several users are using computer system at the same time, a single CPU system can only execute one instruction at a time. Thus, k. multiprogramming, even with a timesharing operating system, only one program can be in control of the CPU at any given time.
In timesharing system, the various programs can be in one of the following three states:
1. Running: The user’s program currently has control of the CPU. Only one user will be active at a time.
2. Ready: The user’s program is ready to execute but is waiting for its turn to get the CPU. More than one user can be in ready state at a time.
3. Blocked: The user’s program is waiting for some 1/O operation. More than one user can be in wait state at a time.
Requirements of timesharing system
Timesharing systems typically require the following additional hardware and software features:
- A number of terminals simultaneously connected to the system, so that multiple users can simultaneously use the system in interactive mode.
- A relatively large memory to support multiprogramming.
- Memory protection mechanism to prevent one job’s instructions and data from interfering with other jobs.
- A special CPU scheduling algorithm, which allocates the CPU for a very short period, to each user process in a circular fashion.
- An alarm clock mechanism to send an interrupt signal to the CPU after every time slice.
Advantages of timesharing system
1. Reduces CPU idle time: Timesharing reduces idle time of CPU and increases the utilization of CPU by switching from one program to another in rapid succession.
2. Provides advantages of quick response time: The special CPU scheduling algorithm used in time sharing systems ensures quick response time to all users.