Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Lectures_SSD2_Yermakova / Lectures_SSD2 Yermakova.doc
Скачиваний:
226
Добавлен:
25.02.2016
Размер:
3.16 Mб
Скачать

3.3 Resource Sharing

In this module, we are going to look at the operating system as a mechanism for resource sharing. We will see that many aspects of operating system function can be explained in those terms. In the course of explaining how sharing works, this module covers most of the components of the computer system. The computer system not only shares many of its internal resources, such as the processor, but also its external resources, such as the hard disk drive.

Reading Sequence:

  • Review 3.1.3 Process ControlLearning Goal: Multitasking is a way of sharing the processor so that several tasks can appear to execute simultaneously even though there may be only a single CPU. The operating system includes a component called a scheduler to ensure that no task uses so many processor cycles that the other tasks can't run. The scheduler manages the shared resources of the system, giving limited time to each process before reevaluating priority.

  • 3.3.1 Virtual MemoryLearning Goal: Processes must share the available memory on a computer. If there is not enough RAM to meet all requests, the operating system can juggle memory pages between RAM and disk as needed, so that all tasks can continue to run. This scheme is known asvirtual memory.

  • Parsons/Oja, Chapter 5-Section D. Learning Goal: Networking allows multiple users to share drivesfiles, andprinters. There are advantages to sharing these resources, such as the possibility of having several people work on one central project, and disadvantages, such as the difficulty of providing adequate security.

  • 3.3.2 File and Printer SharingLearning Goal: Apply the information learned in the previous reading to understand more about file and printer sharing security and functionality.

  • Review 3.2.1 Interrupt HandlingLearning Goal: When multiple tasks are running at the same time, they must share the monitorkeyboard, and mouse. This is a function of the part of the operating system known as thewindow system. A task does not display data directly on the monitor or read data directly from the keyboard. Instead, each task has one or more windows associated with it, and it reads and writes data through these windows, which function as a virtual screen and keyboard. Understand how the operating system processes data for these resources.

       

Assessments:

  • Multiple-Choice Quiz 10

3.3.1 Virtual Memory

  • Managing Memory

  • Relocation

  • Virtual Memory

Managing Memory

Managing the system's memory is an important job of the kernel. Some of the computer's main memory (DRAM) is reserved for the operating system, but most of it is available for user programs. Let us say a user is running a Web browser, an editor, and a computer game. Each of these programs needs a certain amount of memory, but none of them needs access to all the memory. The kernel allocates some memory to each program and keeps track of what program is using what.

Modern operating systems such as Linux and Windows provide virtual memory, to increase program flexibility. (We will say more about exactly what virtual memory is, later.) To understand why virtual memory is useful, let us start by looking at how older operating systems like MS-DOS worked. In those systems, all programs ran in the same real address space, since there was no virtual address space.

Executable programs, written in binary machine code, contain instructions and data. Both instructions and data contain memory addresses. So when you write a program in machine code (or a compiler translates your high-level language into machine code for you), you (or the compiler) must calculate the address for every instruction and every piece of data. Let us say you start at zero and lay out all your instructions and data in sequence, so your entire program occupies memory addresses 0 through 8,462. Now, suppose everyone else writes their programs the same way, starting at address 0. Obviously, you cannot run two programs that occupy the same memory addresses at the same time with this scheme—since as soon as you load the second one, it will overwrite the first.