CS480 Midterm

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is the difference between Job and Process?

A process refers to a program under execution. This program may be an application or system program. Job means an application program and it is not a system program.

What is a scheduler and what types of schedulers are there?

A scheduler is the process that selects the appropriate process for execution. A long-term scheduler (job scheduler) selects processes from the appropriate pool and loads them into memory for execution. The short-term schedule (CPU Scheduler) selects processes that are ready to execute and allocates the CPU to one of the processes.

Explain what semaphores are and how they work.

A semaphore is either a binary or integer value that tracks usage of a certain resource. If all of that resource is in use the semaphore is zero. Wait() decrements the semaphore Signal() increments the semaphore A binary semaphore can only have a value of 1 or 0. Integer semaphores can hold any number >= 0. In both cases the execution fails when attempting to wait with a counter that is already equal to zero. Incrementing a binary semaphore already at one does not cause a failure. Integer semaphores can be implemented to hold numbers less than zero. If wait() is called and (the semaphore holding a value) S <= 0, then decrement S and append the process calling wait() to a waiting "queue". If a process makes a signal() call and S < 0, then increment S and dequeue the waiting process. If S = 0, no one is in the waiting queue and no one is waiting to execute. In the case of our project, S is initialized to 1 since we are running everything one at a time.

What is a thread? How is it different from a process? Where would you use a thread over a process and vice-versa?

A thread is a basic unit of CPU utilization; it comprises a thread ID, a program counter, a register set, and a stack. Threads are used for small tasks, whereas processes are used for more 'heavyweight' tasks like the execution of applications. A thread is a path of execution within a process that can simplify code and increase efficiency. A thread is best used for small or otherwise lightweight tasks, such as a single instance of a browser. A process can be used for more heavy weight tasks like a large-scale program such as a video editor.

What is the operational difference between single-threaded and multi-threaded processes? i.e., how does it change the usage of each?

A traditional (or heavyweight) process has a single thread of control. If a process has multiple threads of control, it can perform more than one task at a time.

A semaphore is a shared integer variable -

Binary Semaphores : They can only be either 0 or 1. They are also known as mutex locks, as the locks can provide mutual exclusion. All the processes can share the same mutex semaphore that is initialized to 1. Then, a process has to wait until the lock becomes 0

What is CP/M, what does it stand for, and how did MS-DOS differ from it?

CP/M was a early "standard" operating system. It was written by Gary Kindall of Digital Research, Inc. It stands for Control Program/Monitor. MS-DOS was very similar to CP/M but had a richer set of build in commands that was mostly modeled after TOPS-10. It supported 640 KB of memory with the ability to address "extended" and "expanded" memory to get somewhat beyond that limit. However, it lacked protected memory.

What criteria is taken into account when scheduling algorithms may favor one class of process over another?

CPU utilization. We want to keep the CPU as busy as possible. Conceptually, CPU utilization can range from 0 to 100 percent. In a real system, it should range from 40 percent (for a lightly loaded system) to 90 percent (for a heavily loaded system). Throughput. If the CPU is busy executing processes, then work is being done. One measure of work is the number of processes that are completed per time unit, called throughput. For long processes, this rate may be one process per hour; for short transactions, it may be ten processes per second. Turnaround time. From the point of view of a particular process, the important criterion is how long it takes to execute that process. The interval from the time of submission of a process to the time of completion is the turnaround time. Turnaround time is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O. Waiting time. The CPU-scheduling algorithm does not affect the amount of time during which a process executes or does I/O. It affects only the amount of time that a process spends waiting in the ready queue.Waiting time is the sum of the periods spent waiting in the ready queue. Response time. In an interactive system, turnaround time may not be the best criterion. Often, a process can produce some output fairly early and can continue computing new results while previous results are being output to the user. Thus, another measure is the time from the submission of a request until the first response is produced. This measure, called response time, is the time it takes to start responding, not the time it takes to output the response. The turnaround time is generally limited by the speed of the output device.

What is the value of a multilevel queue scheduling strategy?

Common division is made between foreground (interactive) processes and background (batch) processes. These two types of processes have different response-time requirements and so may have different scheduling needs. In addition, foreground processes may have priority (externally defined) over background processes.A multilevel queue scheduling algorithm partitions the ready queue into several separate queues. The processes are permanently assigned to one queue, generally based on some property of the process, such as memory size, process priority, or process type. Each queue has its own scheduling algorithm. For example, separate queues might be used for foreground and background processes. The foreground queue might be scheduled by an RR algorithm, while the background queue is scheduled by an FCFS algorithm. In addition, there must be scheduling among the queues, which is commonly implemented as fixed-priority preemptive scheduling. For example, the foreground queue may have absolute priority over the background queue.

Describe concurrency and synchronization.

Concurrency: multiple processes taking turns running, may appear simultaneous due to fast switching by CPU scheduler but never progressing at the same time. Each process makes a little progress at a time. Can provide data inconsistencies because 2 processes could be manipulating same set of data. Synchronization: sharing system resources by use of processes to avoid race conditions/ inconsistent data. Only allowing 1 process to manipulate variable(think counter variable example). Going back and forth carefully.

Name the three methods for handling Deadlock and a give short explanation.

Deadlock prevention or avoidance: The idea is to not let the system into deadlock state. Deadlock detection and recovery: Let deadlock occur, then do preemption to handle it once occurred. Ignore the problem altogether: If deadlock is very rare, then let it happen and reboot the system.

Explain what a deadlock is and a real-life example of a deadlock.

Deadlock us a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. An example when two trains are coming toward each other on same track and there is only one track, none of the trains can move once they are in front of each other.

What is the difference between a deadlock and an unsafe state

Deadlock: All resources are being used. Unsafe State: There is the potential for a deadlock to occur.

Name and explain at least three types of system programs?

File Modification: Several text editors may be available to create and modify the content of files stored on disk or other storage devices. There may also be special commands to search contents of files or perform transformations of the text. File Management: These programs create, delete, copy, rename, print,dump, list, and generally manipulate files and directories. Status Information: Some programs simply ask the system for the date,time, amount of available memory or disk space, number of users, or similar status information. Others are more complex, providing detailed performance, logging, and debugging information. Typically, these pro-grams format and print the output to the terminal or other output devices or files or display it in a window of the GUI. Some systems also support a registry, which is used to store and retrieve configuration information.

Name/explain at least three system services.

File management: responsible for creating, deleting, copying, renaming, printing, dumping, and listing files and directories Status information: responsible for retrieving date, time, available memory, etc. or more complex values like debugging info, logging, etc. Most often returned to a terminal window or stored in a registry. File modification: i.e. text editors to modify contents of files, and commands to change/search through files.Programming language support: the system includes compilers, interpreters, debuggers, etc. for widely used programming languages.

Compare and contrast RR scheduling and FCFS scheduling (don't just define the two). Explain the difference between preemptive and non-preemptive scheduling

First Come First Serve non-preemptively executes processes as they appear to the scheduler. Round Robin the preemptive version of FCFS, more "fairly" executing the processes. RR executes a process for a certain number of cycles then switches to the next remaining process by order of arrival. Both scheduling protocols sort processes based on when they became available for execution. A preemptive process, such as RR, interrupts--or preempts--the currently running process after a certain amount of time to run the next available process

Draw a structure representing an operating system explain how each section interacts with one another

HOSU (hardware, operating system, system calls, user and other system programs) diagram The user can only access and manipulate the hardware via the the OS, The way in which the user interacts with the system in through some form of UI by utilizing system calls. System services provide services to the users and the programs.

List two advantages of multiprogramming, and explain why it is an advantage.

Improved Memory Utilization − In multiprogramming, more than one program resides in main memory. Thus memory is optimally utilized. Increased Resources Utilization − In multiprogramming, multiple programs are actively competing for resources resulting in higher degree of resource utilization.

What are some reasons why providing an environment that allows process cooperation would be beneficial?

Information sharing. Since several users may be interested in the same piece of information (for instance, a shared file), we must provide an environment to allow concurrent access to such information. Computation speedup. If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others. Notice that such a speedup can be achieved only if the computer has multiple processing cores. Modularity. We may want to construct the system in a modular fashion, dividing the system functions into separate processes or threads, as we discussed in Chapter 2. Convenience. Even an individual user may work on many tasks at the same time. For instance, a user may be editing, listening to music, and compiling in parallel.

Ideally, we want the programs and data to reside in main memory permanently. This arrangement usually is not possible for the following two Reasons. List one of the two reasons.

Main memory is usually too small to store all needed programs and data Permanently. Main memory is a volatile storage device that loses its contents when power is turned off or otherwise lost.

What are the four conditions necessary for a deadlock? Explain each one. Also, provide a real world example of a deadlock

Mutual Exclusion- One process is holding a resource and this process is the only one that can use it, Hold and Wait- A process is holding onto a resource while it is waiting for another resource No Preemption- A process must release a resource one its own, Circular Wait- One process holds a resource while it is waiting on another resource while another process does the same. Many real world examples but one example is when you can't get a job because you need experience but you can't get experience until you get the job.

Identify and explain the three requirements for the critical section problem.

Mutual exclusion. If process Pi is executing in its critical section, then no other processes can be executing in their critical sections. Progress. If no process is executing in its critical section and some processes wish to enter their critical sections, then only those processes that are not executing in their remainder sections can participate in deciding which will enter its critical section next, and this selection cannot be postponed indefinitely. Bounded waiting. There exists a bound, or limit, on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted. Mutual exclusion. If process Pi is executing in its critical section, then no other processes can be executing in their critical sections. Progress. If no process is executing in its critical section and some processes wish to enter their critical sections, then only those processes that are not executing in their remainder sections can participate in deciding which will enter its critical section next, and this selection cannot be postponed indefinitely. Bounded waiting. There exists a bound, or limit, on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted.

What states can a process be in using the 7 state model? Be able to describe the states and transitions.

New: Process is being created Running: Instructions are being executed Blocked: Process is waiting for some event, usually IO Ready: The process has been created and is waiting to be run Terminated: The process has finished Suspended Ready: Too many processes are currently waiting for their turn to run and must be moved to disk Suspended Blocked: Too many processes are currently waiting for some event to occur and must be moved to disk

The address of the next instruction to be executed by the current process is provided by the ____

Program counter

What are four ways to pass data to system calls?

Registers Sharing memory Stack Function parameters

Under the normal mode of operation, a process may utilize a resource in only in the 3 following sequence:

Requests a resource Use the resource Releases the resource

Given a systems resource table, use banker's algorithm to figure out if the system is a in a safe state. If the system is an unsafe state, where could the system encounter a deadlock?

Safe-Unsafe. N/A-Upon executing process i. It depends on the table given.

How does using interrupts help with OS management? What is a software interrupt called?

Software interrupt is called a system call or monitor call interrupts allow for multiple I/O sources to be utilized while the OS is running.

Multilevel algorithms are created for situations in which processes are easily classified into 5 different groups. What are the names of the five queues?

System Processes Interactive Processes Interactive Editing Processes Batch Processes Student Processes

Define the different types of parallelism and give a real-life example of each.

Task parallelism involves distributing not data but tasks (threads) across multiple computing cores. Each thread is performing a unique operation.Different threads may be operating on the same data, or they may be operating on different data. Data parallelism focuses on distributing subsets of the same data across multiple computing cores and performing the same operation on each core

List the advantages and disadvantages that makes a one to one or one to many model different.

The one-to-one model creates a separate kernel thread to handle each user thread. One-to-one model overcomes the problems involving blocking system calls and the splitting of processes across multiple CPUs. However the overhead of managing the one-to-one model is more significant, involving more overhead and slowing down the system. The many-to-many model multiplexes any number of user threads onto an equal or smaller number of kernel threads, combining the best features of the one-to-one and many-to-one models. Users have no restrictions on the number of threads created.Blocking kernel system calls do not block the entire process.

When a process creates a new process, list one of the two possibilities that allow the execution to exist.

The parent continues to execute concurrently with its children The parent waits until some or all of its children have terminated.

Given that we can create user-level code to control access to critical sections (Peterson's algorithm), why is it important for an operating system to provide synchronization facilities such as semaphores in the kernel?

To avoid busy waiting: the waiting thread can go to sleep a creates better cpu utilization; avoids priority inversion if that there is an issue

Draw the top four levels of Storage Device Hierarchy used for semiconductor memory.

Top - Bottom = Registers -> cache -> main memory -> solid-state disk

Describe two of the four circumstances that CPU scheduling decisions go through.

When a process switches from the running state to the waiting state(for I/O request or invocation of wait for the termination of one of the child processes). When a process switches from the running state to the ready state (for example, when an interrupt occurs). When a process switches from the waiting state to the ready state(for example, completion of I/O). When a process terminates.

What is priority inversion and why is it used.

When high priority task is indirectly preempted by medium priority task effectively inverting the relative priority of the two tasks

Match the following definitions with the correlating term.

___ is responsible for reading and carrying out the instructions on the cards at the point of execution. ___ used by both the control-card interpreter and the loader for the system's I/O devices. Often, the system and application programs are linked to these same device drivers, providing continuity in their operation, as well as saving memory space and programming time. ___ invoked by the control-card interpreter to load system programs and application programs into memory at intervals --------------------------------- control-card interpreter Loader Device drivers

What enables a process to wait within the monitor?

a condition variable must be declared as a condition

If the kernel is single threaded, then any user level thread performing a blocking system call will,

cause the entire process to block even if the other threads are available to run

Multithreading an interactive program will increase responsiveness to the user by.

continuing to run even if a part of it is blocked

Because the kernel thread management is done by the Operating System itself.

kernel threads are slower to create than user threads

A thread shares its resources(like data section, code section, open files, signals) with.

other threads that belong to the same process

What algorithm allows the CPU to be allocated to the process with the highest priority.

priority scheduling

A component involved in the CPU-scheduling function is the dispatcher. Define the three function involve with the dispatcher.

• Switching context • Switching to user mode • Jumping to the proper location in the user program to restart that program


Ensembles d'études connexes

Information Security - Midterm 1

View Set

Study Guide for the US History WWII Test

View Set