Which operating system function allows more than one program can run at the same time?

Prelab 5 : Operating Systems


This lab was originally developed by Tammy Bailey

Reading

  • Computer Science - an Overview; Chapter 3, pay particular attention to section 3.4
  • How to Think Like a Computer Scientist: Learning with Python: Chapters 1 & 2

Operating Systems

The operating system is the most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers.

Which operating system function allows more than one program can run at the same time?

Operating systems can be classified as follows:

  • multi-user: Allows two or more users to run programs at the same time. Some operating systems permit hundreds or even thousands of concurrent users.
  • multiprocessing: Supports running a program on more than one CPU.
  • multitasking: Allows more than one program to run concurrently.
  • multithreading: Allows different parts of a single program to run concurrently.
  • real time: Responds to input instantly. General-purpose operating systems, such as DOS and UNIX, are not real-time.
  • Operating systems provide a software platform on top of which other programs, called application programs, can run. The application programs must be written to run on top of a particular operating system. Your choice of operating system, therefore, determines to a great extent the applications you can run. For example, Microsoft Word is an application that runs on the Windows operating system, but not on the Linux operating system.

    As a user, you normally interact with the operating system through a set of commands. For example, the UNIX operating system contains commands such as cp and mv for copying files and changing the names of files, respectively. The commands are accepted and executed by a part of the operating system called the command processor or command line interpreter. Graphical user interfaces allow you to enter commands by pointing and clicking at objects that appear on the screen, as in the Windows operating system.

    [ www.webopedia.com]

    Processes

    A task or process refers to the combination of a program being executed and bookkeeping information used by the operating system. For large multi-user and multitasking systems, the operating system has even greater responsibilities and powers. It is like a traffic cop -- it makes sure that different processes and users running at the same time do not interfere with each other. Processes running concurrently are often in contention for resources, like memory or processor time. Often only one process can have a certain resource at a time. Part of the operating system's job, then, is to decide a strategy for giving access to these resources.

    [ www.webopedia.com]

    Threads

    You are already likely most familiar with the idea of sequential programs. That is, each has a beginning, an execution sequence, and an end. At any given time during the runtime of the program, there is a single point of execution. A thread is similar to the sequential programs described previously. A single thread also has a beginning, a sequence, and an end and at any given time during the runtime of the thread, there is a single point of execution. However, a thread itself is not a program; it cannot run on its own. Rather, it runs within a program. The following figure shows this relationship.

    Which operating system function allows more than one program can run at the same time?


    Definition: A thread is a single sequential flow of control within a program.

    There is nothing new in the concept of a single thread. The real hoopla surrounding threads is not about a single sequential thread. Rather, it's about the use of multiple threads in a single program, running at the same time and performing different tasks. This is illustrated by the following figure:

    Which operating system function allows more than one program can run at the same time?

    A modern web browser is an example of a multithreaded application. Within the browser, you can scroll a page while it's downloading an applet or image, play animation and sound concurrently, print a page in the background while you download a new page, or watch three sorting algorithms race to the finish. You are used to life operating in a concurrent fashion...so why not your browser?

    Some texts use the name lightweight process instead of thread. A thread is similar to a real process in that a thread and a running program are both a single sequential flow of control. However, a thread is considered lightweight because it runs within the context of a full-blown program and takes advantage of the resources allocated for that program and the program's environment.

    As a sequential flow of control, a thread must carve out some of its own resources within a running program. (It must have its own execution stack and program counter for example.) The code running within the thread works only within that context. Thus, some other texts use execution context as a synonym for thread.

    [ java.sun.com]

    Questions

    1. Suppose that there are many, many processes that are competing for one or two resources. Is the performance of the system affected? How?

    2. Sometimes the operating system manages processes that are of differing importance. It may be that the priority of the process running should be taken into account when allocating resources. For example, there could be two processes running on a spaceship's computer. One controls the trajectory of the ship, and the other controls the air conditioning on the ship. Which should get more processor time? Describe a change to the model that includes a bias toward higher priority processes without starving the other processes.

    3. Suppose that many processes are sharing one resource, a phone list.  Some processes, called readers, only look up phone numbers, they never change them.  Other processes, called writers, may look up numbers, but may also change the numbers.  How many readers should be allowed access to the phone list at once?  How many writers should be allowed access to the phone list at once?  How many readers should be allowed access to the phone list while a writer has access?

    4. The idea of having many things going on at the same time is known as multi-tasking. This idea has infiltrated many parts of our daily lives. For example, when is the last time that you ate without also watching TV or talking to someone? Have you ever walked into a room and been so engrossed in another thought that you forgot why you went there? Give other examples of daily multitasking. How hard would it be for you to do only one thing at a time?


    What allows multiple programs to run on a computer?

    Multiprocessing: Supports running a program on more than one CPU. Multitasking: Allows more than one program to run concurrently. Multithreading: Allows different parts of a single program to run concurrently.

    Can you have two operating systems running at the same time?

    Most computers can be configured to run more than one operating system. Windows, macOS, and Linux (or multiple copies of each) can happily coexist on one physical computer.