Wednesday, April 9, 2014

Time Sharing System

A time sharing system allows many users to share the computer resources simultaneously. In other words, time sharing refers to the allocation of computer resources in time slots to several programs simultaneously. For example a mainframe computer that has many users logged on to it. Each user uses the resources of the mainframe -i.e. memory, CPU etc. The users feel that they are exclusive user of the CPU, even though this is not possible with one CPU i.e. shared among different users.
The time sharing systems were developed to provide an interactive use of the computer system. A time shared system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared computer. It allows many users to share the computer resources simultaneously. As the system switches rapidly from one user to the other, a short time slot is given to each user for their executions.
The time sharing system provides the direct access to a large number of users where CPU time is divided among all the users on scheduled basis. The OS allocates a set of time to each user. When this time is expired, it passes control to the next user on the system. The time allowed is extremely small and the users are given the impression that they each have their own CPU and they are the sole owner of the CPU. This short period of time during that a user gets attention of the CPU; is known as a time slice or a quantum. The concept of time sharing system is shown in figure.
                               
In above figure the user 5 is active but user 1, user 2, user 3, and user 4 are in waiting state whereas user 6 is in ready status.
As soon as the time slice of user 5 is completed, the control moves on to the next ready user i.e. user 6. In this state user 2, user 3, user 4, and user 5 are in waiting state and user 1 is in ready state. The process continues in the same way and so on.
The time-shared systems are more complex than the multi-programming systems. In time-shared systems multiple processes are managed simultaneously which requires an adequate management of main memory so that the processes can be swapped in or swapped out within a short time.
Note: The term 'Time Sharing' is no longer commonly used, it has been replaced by 'Multitasking System'
  • While multiprogrammed systems used resources more efficiently i.e. minimized CPU idle time, a user could not interact with a program.
  • Time-Sharing Systems Interactive Computing. Time sharing (or multitasking) is a logical extension of multiprogramming. In time-sharing systems, the CPU executes multiple jobs by switching among them, but the switches occur so frequently that the users can interact with each program while it is running.
  • The user gives instructions to the OS or to a program directly, using a input device such as a keyboard or a mouse, and waits for immediate results on an output device. Accordingly, the response time should be short-typically less than one second.
  • As the system switches rapidly from one user to the next, each user is given the impression that the entire computer system is dedicated to his use, even though it is being shared among many users.
  • The CPU switches to the next job that can be run whenever the current job enters a wait state or after the current job has used a standard unit of time.
  • When viewed over a relatively long time frame, we obtain the appearance that the CPU is simultaneously running multiple programs.
  • A time-shared OS uses CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared computer.
  • Time-sharing and multiprogramming require several jobs to be kept simultaneously in memory. Since in general main memory is too small to accommodate all jobs, the jobs are kept initially on the disk in the job pool.
  • Processes are swapped in and out of main memory to the disk. In effect, we are now ``memory sharing'' between competing users (programs). This idea leads to a mechanism called virtual memory.
  • Virtual memory is a technique that allows the execution of a process that is not completely in memory. The main advantage of the virtual-memory scheme is that it enables users to run programs that are larger than actual physical memory.
  • If several jobs are ready to be brought into memory, and if there is not enough room for all of them, then the system must choose among them. Making this decision is job scheduling.
  • When the OS selects a job from the job pool, it loads that job into memory for execution. Having several programs in memory at the same time requires some form of memory management.
  • In addition, if several jobs are ready to run at the same time, the system must choose among them. Making this decision is CPU scheduling.
  • Further, it abstracts main memory into a large, uniform array of storage, separating logical memory as viewed by the user from physical memory.
  • This arrangement frees programmers from concern over memory-storage limitations.
  • Time-sharing systems must also provide a file system. The file system resides on a collection of disks; hence, disk management must be provided.
  • Also, time-sharing systems provide a mechanism for protecting resources from inappropriate use.
  • To ensure orderly execution, the system must provide mechanisms for job synchronization and communication, and it may ensure that jobs do not get stuck in a deadlock, forever waiting for one another.
  • New OS Functionalities: More complex job scheduling, memory management, concurrency control and synchronization.
  • The sensible sharing of resources such as CPU time and memory must be handled by the OS. For this control program to always be in control, we require that it never be blocked from running. The OS, which might in fact be organized like a small number of cooperating programs, will lock itself into memory and then control CPU allocation priority in order that it never be blocked from running.

Time-sharing operating systems

Time sharing is a technique which enables many people, located at various terminals, to use a particular computer system at the same time. Time-sharing or multitasking is a logical extension of multiprogramming. Processor's time which is shared among multiple users simultaneously is termed as time-sharing. The main difference between Multiprogrammed Batch Systems and Time-Sharing Systems is that in case of Multiprogrammed batch systems, objective is to maximize processor use, whereas in Time-Sharing Systems objective is to minimize response time.
Multiple jobs are executed by the CPU by switching between them, but the switches occur so frequently. Thus, the user can receives an immediate response. For example, in a transaction processing, processor execute each user program in a short burst or quantum of computation. That is if n users are present, each user can get time quantum. When the user submits the command, the response time is in few seconds at most.
Operating system uses CPU scheduling and multi-programming to provide each user with a small portion of a time. Computer systems that were designed primarily as batch systems have been modified to time-sharing systems.
Advantages of Time sharing operating systems are following
·         Provide advantage of quick response.
·         Avoids duplication of software.
·         Reduces CPU idle time.
Disadvantages of Timesharing operating systems are following.
·         Problem of reliability.
·         Question of security and integrity of user programs and data.
·         Problem of data communication.


No comments:

Post a Comment