Αρχική ΑΕΠΠ - Δομές Δεδομένων Λειτουργικά Συστήματα Δίκτυα Υπολογιστών ΙΙ Βάσεις Δεδομένων Παιδαγωγικά - Διδακτική
Εισαγωγή στα Λ.Σ. Βασικές Δομές Η/Υ Βασικές Δομές Λ.Σ
Διεργασίες Χρονοπρογραμματισμός Συγχρονισμός
Μονοπρογραμματισμός Εναλλαγή Εικονική Μνήμη Κατάτμηση
In this section we introduce the concept of a process and the notion of concurrent execution. Those are at the very heart of modern operating systems. A process is is a program in execution and is the unit of work in a modern time-sharing system. Such a system consists of a collection of processes: Operating-system processes executing system code, and user processes executing user code. All these processes can potentially execute concurrently, with the CPU (or CPUs) multiplexed among them. By switching the CPU between processes, the operating system can make the computer more productive. We also discuss the notion of a thread (light-weight process) and interprocess communication (IPC).
What is a process?
A program in execution.
What is a PCB?
Process control block. It contains various data structures.
List some of the queues on a typical system.
Ready, run, I/O.
How are these queues typically implemented?
FIFO queues, trees, linked-lists.
How many device queues are there on a system?
One for each device.
What does the long-term scheduler do?
Determines which jobs belong in the current mix of running/waiting jobs.
Determines which jobs belong in the current mix of running/waiting jobs.
Determines which of the current jobs should run in the next CPU burst.
Which scheduler must work very fast in order not to waste significant CPU time? Which can be slow?
Fast: short-term. Slow: long-term.
What is the “degree of multiprogramming?”
Number of jobs in the current mix of running/waiting jobs.
When is the long-term scheduler invoked?
When a job is completed, or when the degree of multiprogramming hasn’t yet been reached.
True/False: The long-term scheduler selects a group of I/O-bound jobs or a group of CPU-bound programs for subsequent activity. Explain.
False. It selects a mix of jobs for efficient machine utilization.
What is time sharing? What kind of scheduling does it involve?
Time sharing is many users interactively using a system “simultaneously;” each user gets a share of CPU-time, after other users have gotten their share. It uses medium-term scheduling, such as round-robin for the foreground. Background can use a different scheduling technique.
Explain the meaning of: “time sharing depends on negative feedback of the users for speedy operation.”
Users who are impatient with the long response time will log off, resulting in fewer users on the system, with faster response time.
What is swapping?
Copying a process out of memory onto a fast disk or drum, to allow space for other active processes; it will be copied back into memory when space is ample.
What is a context switch?
The time needed to switch from one job to another.
Describe five implementations of the create-new-process mechanism.
Describe the producer/consumer problem.
The consumer can’t be allowed to use a result until the producer has created that result, and the producer can’t be allowed to create results if the buffers are all full.
Give examples of producer/consumer pairs.
compiler/linker, linker/loader, card-reader/line-printer
How do you implement a circular array?
Using mod arithmetic, like in clocks. Note: Several students have said by using linked lists; not so, authors replace the circular array with a linked list.
How do you determine if the buffers (or arrays) are all full in circular arrays?
If the input-pointer is one less than the output-pointer in mod arithmetic.
How do you determine if the buffers (or arrays) are all empty?
If the input-pointer equals output-pointer.
Several popular microcomputer operating systems provide little or no means of concurrent processing. Discuss the major complications that concurrent processing adds to an operating system.
Describe the differences among short-term, medium-term, and long-term scheduling.
The primary difference is in the frequency of their execution. The short-term must select a new process quite often. Long-term is used much less often since it handles placing jobs in the system, and may wait a while for a job to finish before it admits another one.
A DECSYSTEM-20 computer has multiple register sets. Describe the actions of a context switch if the new context is already loaded into one of the register sets. What else must happen if the new context is in memory rather than a register set, and all the register sets are in use?
The CPU current-register-set pointer is changed to point to the set containing the new context, which takes very little time. If the context is in memory, one of the contexts in a register set must be chosen and moved to memory, and the new context must be loaded from memory into the set. This process takes a little more time than on systems with one set of registers, depending on how a replacement victim is selected.
What two advantages do threads have over multiple processes? What major disadvantage do they have? Suggest one application that would benefit from the use of threads, and one that would not.
Threads are very inexpensive to create and destroy, and they use very little resources while they exist. They do use CPU time for instance, but they don’t have totally separate memory spaces. Unfortunately, threads must “trust” each other to not damage shared data. For instance, one thread could destroy data that all the other threads rely on, while the same could not happen between processes unless they used a system feature to allow them to share data. Any program that may do more than one task at once could benefit from multitasking. For instance, a program that reads input, processes it, and outputs it could have three threads, one for each task. “Single-minded” processes would not bene?t from multiple threads; for instance, a program that displays the time of day.
What resources are used when a thread is created? How do they differ from those used when a process is created?
A context must be created, including a register set storage location for storage during context switching, and a local stack to record the procedure call arguments, return values, and return addresses, and thread-local storage. A process creation results in memory being allocated for program instructions and data, as well as thread-like storage. Code may also be loaded into the allocated memory
Describe the actions taken by a kernel to switch context
What are the differences between user-level threads and kernel-supported threads? Under what circumstances is one type “better” than the other?
User-level threads have no kernel support, so they are very inexpensive to create, destroy, and switch among. However, if one blocks, the whole process blocks. Kernel-supported threads are more expensive because system calls are needed to create and destroy them and the kernel must schedule them. They are more powerful because they are independently scheduled and block individually.
Consider the interprocess-communication scheme where mailboxes are used. Suppose a process P wants to wait for two messages, one from mailbox A and one from mailbox B. What sequence of send and receive should it execute?
Consider an operating system that supports both the IPC and RPC schemes. Give examples of problems that could be solved with each type of scheme. Explain why each problem is best solved by the method that you specify.
Copyright 2008 - Άρης Φεργάδης