3.1 Overview

A Time-Sharing Operating System is a type of operating system designed to allow multiple users or multiple processes to share the CPU simultaneously. Instead of allowing one program to use the CPU until completion, the operating system divides CPU time into very small intervals known as time slices or time quanta.

Each process gets access to the CPU for a limited amount of time before the operating system switches to another process. Because these switches occur extremely quickly, users perceive that multiple programs are running at the same time.

Time-sharing systems were developed to improve:

  • Interactivity

  • CPU utilization

  • Multi-user access

  • System responsiveness

These systems became highly important in environments where many users needed to access the same computer simultaneously through terminals.

3.2 Working Mechanism

In a time-sharing operating system, the CPU scheduler allocates a small unit of CPU time to each ready process.

Step 1: Process Arrival

Multiple users or programs submit processes to the operating system.

Step 2: Ready Queue Formation

Processes waiting for CPU execution are placed in the ready queue.

Step 3: Time Quantum Allocation

The scheduler assigns a fixed time quantum to each process.

Examples:

  • 10 milliseconds

  • 20 milliseconds

  • 50 milliseconds

Step 4: CPU Execution

The selected process executes until:

  • Its time quantum expires

  • It completes execution

  • It enters waiting state for I/O

Step 5: Context Switching

When the time slice ends:

  • The operating system saves the current process state

  • Loads the next process state

  • Transfers CPU control

This operation is known as:

Context Switching

Step 6: Repetition

The cycle continues repeatedly among all active processes.

Because switching occurs very rapidly:

  • Users experience interactive computing

3.3 Characteristics

Interactive System

Time-sharing systems are highly interactive because users receive quick responses to commands and inputs.

Multi-User Support

Many users can access the same system simultaneously through different terminals or sessions.

Fast Response Time

The system attempts to minimize response time so that users do not experience noticeable delays.

CPU Sharing

CPU time is shared fairly among processes using scheduling algorithms.

Frequent Context Switching

The operating system performs rapid context switching to maintain multitasking.

Multiprogramming

Several programs remain in memory simultaneously for efficient execution.

Resource Sharing

Users share:

  • CPU

  • Memory

  • Storage

  • Peripheral devices

3.4 Scheduling in Time-Sharing Systems

Time-sharing operating systems commonly use:

Round Robin Scheduling

Round Robin Principle

  • Each process receives equal CPU time

  • Processes execute cyclically

  • Prevents starvation

Importance

Round Robin improves:

  • Fairness

  • Responsiveness

  • Interactive performance

3.5 Context Switching

Context switching is one of the most important concepts in time-sharing systems.

During a context switch, the operating system saves:

  • Program counter

  • CPU registers

  • Process state

  • Memory information

Then it restores another process state.

Purpose

Allows multiple processes to share the CPU safely.

Drawback

Too many context switches increase:

  • CPU overhead

  • Scheduling cost

  • Performance loss

3.6 Advantages

Improved Responsiveness

Users receive quick responses even when many processes are running.

Efficient CPU Utilization

CPU idle time is reduced because another process executes whenever one waits for I/O.

Supports Multitasking

Multiple applications can run concurrently.

Examples:

  • Browser

  • Text editor

  • Music player

running simultaneously.

Better Resource Sharing

Hardware resources are shared efficiently among users.

Supports Multiple Users

Several users can work on the same system simultaneously.

3.7 Disadvantages

Context Switching Overhead

Frequent switching consumes CPU time and system resources.

Security Concerns

Multiple users sharing the same system may create:

  • Permission issues

  • Unauthorized access risks

  • Data leakage possibilities

Complex Scheduling

Managing many users and processes requires advanced scheduling mechanisms.

Performance Degradation

If too many users are active:

  • Response time may increase

  • System performance may decrease

3.8 Time Quantum Selection

Choosing an appropriate time quantum is very important.

Very Small Quantum

Advantages:

  • Better responsiveness

Disadvantages:

  • Excessive context switching

Very Large Quantum

Advantages:

  • Reduced overhead

Disadvantages:

  • Poor interactive performance

3.9 Real-World Examples

UNIX

One of the earliest and most important time-sharing operating systems.

Features:

  • Multi-user support

  • Process scheduling

  • Interactive shell

Linux

Modern Linux systems support:

  • Time-sharing

  • Multitasking

  • Multi-user environments

Linux uses advanced schedulers such as:

  • Completely Fair Scheduler (CFS)

Windows

Modern Windows operating systems also support time-sharing concepts through multitasking and process scheduling.

3.10 Difference Between Batch and Time-Sharing Systems

FeatureBatch OSTime-Sharing OS
User InteractionMinimalHigh
Response TimeSlowFast
CPU SharingSequentialSimultaneous sharing
Multi-user SupportLimitedStrong
Primary GoalThroughputResponsiveness

3.11 Real-World Analogy

Imagine a teacher helping many students in a classroom.

Instead of teaching only one student for an entire hour, the teacher:

  • Spends one minute with each student repeatedly

All students feel attended to continuously.

Similarly:

  • The operating system rapidly switches between processes.

3.12 Applications of Time-Sharing Systems

Time-sharing systems are commonly used in:

  • University servers

  • Cloud systems

  • Terminal-based systems

  • Multi-user Linux servers

  • Shared computing environments