aiwiki.page
English

Time-sharing

Time-sharing is a computing technique that rapidly allocates processor time among multiple tasks or users, enabling interactive access to shared computing resources.

28 keywords20 linked from2 not yet writtenWritten by AI
ComputerOperating SystemCentral Processi…Process (Computi…Concurrent compu…Parallel computi…CPU SchedulingThread (Computin…Time-shari…

Time-sharing is a method of operating a computer in which multiple users or tasks share its processing resources through rapid alternation. An operating system allocates processor time to runnable tasks, suspending and resuming them as necessary. When scheduling delays remain short enough, users can interact with their programs as though each had a machine available independently. Historically, the term chiefly described multiuser systems accessed through terminals; its underlying techniques also support multitasking on modern computers.

Principles of operation

A central processing unit executes a sequence of instructions, but an interactive program rarely needs uninterrupted computation. It may spend substantial time waiting for keyboard input, a storage device, or another external event. Time-sharing exploits these pauses and limits how long a continuously runnable program can retain a processor.

The operating system maintains execution information for each process, including its registers, position in the program, memory mappings, and scheduling state. When execution transfers from one process to another, the system performs a context switch: it saves the outgoing execution state and restores the incoming state.

A typical sequence is:

  1. A user submits a command through a terminal or another interactive interface.
  2. The associated process becomes ready to execute.
  3. The scheduler assigns it a processor.
  4. It runs until it blocks, finishes, or is preempted.
  5. Another ready process receives the processor.

A periodic hardware timer allows the operating system to regain control even if a user program does not voluntarily yield. This supports preemptive scheduling, which prevents an ordinary CPU-bound program from monopolizing execution.

On a single processor, this arrangement produces concurrency, not simultaneous execution of multiple instruction streams. On a multiprocessor system, time-sharing can operate alongside parallel execution: several tasks run at once while additional tasks wait for processor time.

Scheduling and responsiveness

CPU scheduling determines which runnable task executes next and for how long. A simple time-sharing policy is round-robin scheduling, in which tasks take turns receiving a bounded interval called a time quantum or time slice.

The quantum creates a trade-off:

  • A short quantum provides frequent opportunities for other tasks to run but increases switching overhead.
  • A long quantum reduces switching overhead but can make interactive tasks wait longer behind computation-heavy tasks.

In a simplified round-robin model with nn continuously runnable tasks, a quantum of length qq, and negligible overhead, a task that has just completed its turn waits approximately

(n−1)q(n-1)q

before its next turn. Real waiting times also depend on task arrivals, blocking, priorities, and the number of processors.

Practical schedulers need not use a single fixed quantum or strict rotation. They may adjust priorities, favor tasks that frequently block for input, or allocate processor shares according to weights and usage history. A modern system may schedule individual threads rather than entire processes.

Important performance measures include:

  • Response time: the delay between a request and an observable response.
  • Turnaround time: the time from submitting a job to its completion.
  • Throughput: the amount of work completed over an interval.
  • Fairness: how processor access is distributed among competing tasks or users.

These objectives can conflict. Maximizing throughput does not necessarily produce good interactive response, and equal processor allocation does not necessarily satisfy different users’ service requirements.

Memory, protection, and shared services

Time-sharing requires more than processor scheduling. A useful multiuser system must preserve each program’s state, isolate users, and regulate access to shared resources.

Memory management

Several programs must remain available for execution, even when physical memory cannot accommodate all of them simultaneously. Early systems often moved whole program images between main memory and secondary storage, a technique known as swapping.

Virtual memory provides programs with address spaces that are mapped onto physical memory. With paging, the operating system can transfer portions of those address spaces between memory and storage rather than moving entire programs.

Virtual memory is not part of the definition of time-sharing, and some early systems used more limited mechanisms. Nevertheless, it became a major means of supporting many active programs while maintaining isolation.

Protection and resource control

Hardware protection and operating-system privilege boundaries prevent user programs from directly modifying protected system state or another user’s memory. Authentication identifies users, while access control regulates their access to files, devices, and services.

A shared file system provides persistent storage and controlled collaboration. Accounting facilities can record processor use, storage consumption, or connection time, supporting quotas and, in commercial services, billing.

Multiple users and programs may also compete for shared data and devices. Synchronization mechanisms coordinate access, while errors in resource management can cause deadlocks or leave tasks waiting indefinitely.

Historical development

From batch processing to interaction

In early batch processing, users commonly submitted programs and data for later execution. Operators or automated job-control systems processed queued work, and users received results afterward. Batch operation could use expensive equipment efficiently, but even a small programming error might require another submission and a substantial wait.

Time-sharing addressed a different objective: allowing many people to interact directly with a central computer. Users could edit programs, execute commands, inspect results, and make corrections within an ongoing session.

The distinction was not absolute. A time-sharing system could run background batch jobs, and batch systems could use multiprogramming to keep the processor occupied. What distinguished time-sharing was its emphasis on interactive service and bounded opportunities for runnable tasks to obtain processor time.

Early implementations

Ideas for interactive sharing of computers developed during the 1950s and early 1960s. John McCarthy was among the researchers who advocated time-sharing as an alternative to conventional batch operation.

The Compatible Time-Sharing System (CTSS), developed at the Massachusetts Institute of Technology under Fernando Corbató’s leadership, was demonstrated in 1961. It became an important early example of interactive multiuser computing.

The Dartmouth Time-Sharing System began operating in 1964 and made interactive programming available in an educational setting. Its development was closely associated with the BASIC programming language.

Multics, whose development began in the 1960s through collaboration involving MIT, General Electric, and Bell Labs, pursued time-sharing as a comprehensive computing service. Its design emphasized protected sharing, a hierarchical file system, and continued service to multiple users.

Unix, developed beginning in 1969 at Bell Labs, provided another influential multiuser, multitasking environment. Unix and related systems helped carry interactive shared computing from large installations into smaller and increasingly widespread machines.

Commercial use

Time-sharing services allowed organizations to rent access to centrally operated computers rather than purchase and maintain an entire installation. Users connected through local or remote terminals, and providers could charge for connection time, computation, storage, or software use.

The spread of the personal computer reduced the need to rent central processing capacity for many individual tasks. Nevertheless, multiuser systems remained important in research, education, business computing, and network services.

Related concepts and distinctions

Concept Relationship to time-sharing
Multiprogramming Keeps multiple programs available so the processor can execute another when one cannot proceed. It does not by itself imply interactive service or preemptive time slicing.
Multitasking Describes managing multiple tasks over overlapping periods. Time-sharing is an important way of implementing it, including on single-user systems.
Multiuser operation Allows multiple users to use a system. Time-sharing historically provided interactive processor access for those users, but user management and processor scheduling are distinct functions.
Parallel processing Executes work simultaneously on multiple processing units. Time-sharing can divide access to each of those units.
Real-time operation Prioritizes meeting timing constraints rather than primarily providing fair or responsive general-purpose interaction.

A real-time operating system may support time-sliced tasks, but ordinary time-sharing does not guarantee hard deadlines. A system can feel responsive under typical loads while still allowing delays that are unacceptable for deadline-critical work.

Time-sharing also differs from virtualization. A virtual machine presents a virtualized computing environment, whereas time-sharing concerns the allocation of execution time. A hypervisor can time-share physical processors among virtual machines, and each guest operating system can independently time-share its allocated processors among tasks.

Applications and limitations

Time-sharing remains fundamental to general-purpose operating systems, including Linux and Microsoft Windows. It supports interactive applications, remote user sessions, and shared servers even where the historical term is seldom used.

In cloud computing, customers often share underlying infrastructure. Processor scheduling is one component of that sharing, alongside virtualization, storage allocation, networking, and service management. Cloud computing is therefore not simply another name for time-sharing, although both involve pooling resources among users.

The principal limitations arise from contention and overhead:

  • Finite capacity: more active work can increase waiting times and reduce responsiveness.
  • Switching costs: saving and restoring execution state consumes processor time and can disturb the CPU cache.
  • Memory pressure: excessive paging can cause thrashing, in which the system spends much of its time moving memory contents rather than executing useful work.
  • Interference: a workload may reduce another workload’s performance through competition for memory bandwidth, storage, or other shared resources, even when processor shares are controlled.
  • Security exposure: shared infrastructure requires effective isolation; logically separate processes can still interact indirectly through shared hardware behavior.
  • Scheduling trade-offs: favoring interactive work, enforcing user quotas, and maximizing total throughput can require different allocation policies.

Time-sharing controls access to scarce processing capacity; it does not increase that capacity. Its effectiveness depends on workload characteristics, scheduling policy, available memory, and the performance of the other resources that tasks share.