CS480 Midterm
Explain why a programmer might use a thread instead of a process
Threads share memory Tasks can be broken down between threads to make concurrency happen A process can run with multiple threads using the same memory space.
Identify and briefly describe the four fundamental components of a computer system
1. Hardware - provides the basic computing resources for the system. 2. OS - controls the hardware and coordinates its use among the various application programs for the various users. 3. Application Programs - define the ways in which these resources are used to solve users' computing problems. 4. User
Briefly explain the difference between a process and a program
A process is a program in execution. a program by itself is not a process. A program is a passive entity, such as a file containing a list of instructions stored on disk a process is an active entity, with a program counter specifying the next instruction to execute and a set of associated resources. A program becomes a process when an executable file is loaded into memory.
Explain what the difference is between a CPU-bound and an I/O-bound process
An I/O-bound process is one that spends more of its time doing I/O than it spends doing computations. A CPU-bound process, in contrast, generates I/O requests infrequently, using more of its time doing computations.
For purposes of CPU scheduling, explain the difference between CPU utilization and throughput, and how they each contribute to the system
CPU utilization - the sum of work handled by a Central Processing Unit Throughput - Number of processes completed per unit.
Briefly explain the difference between asynchronous and synchronous threading
During synchronous threading, the parent waits for the thread to complete Asynchronous - parent continues execution
Explain the difference between internal and external fragmentation; provide an example of each using real world examples not related to computers
External - Total memory space is enough to satisfy a request or to reside a process in it, but it is not contiguous so it can not be used. Ex. Houses Internal - Memory block assigned to process is bigger. Some portion of memory is left unused as it cannot be used by another process Ex. Parking space.
Explain how SJF scheduling works, identify the benefit of using SJF, and identify a problem with using SJF
Shortest Job First When the CPU is available, it is assigned to the process that has the smallest next CPU burst. The SJF scheduling algorithm is provably optimal, in that it gives the minimum average waiting time for a given set of processes. Although the SJF algorithm is optimal, it cannot be implemented at the level of CPU scheduling, as there is no way to know the length of the next CPU burst.
Explain how the OS manages computer hardware, including how it protects hardware from potential misuse
The OS has two modes: user and kernel. Privileged instructions can only be executed in kernel mode.
Explain why operating systems (OS) need to exist
The OS is a resource allocator and a control program, manages the execution of user programs. Provides the environment within which programs are executed. Middleman between software and hardware Users would have to manage their own computers, i.e., load and unload programs
For purposes of CPU scheduling, explain the difference between waiting time and response time.
Turnaround time - The interval from the time of submission of a process to the time of completion. Turnaround time is the sum of the periods spent waiting in the ready queue, executing on the CPU, and doing I/O. Waiting time - the sum of the periods spent waiting in the ready queue. Response time - the time from the submission of a request until the first response is produced. The time it takes to start responding
Explain what a virtual machine is and why it might be necessary
an emulation of a computer system. Virtual machines are based on computer architectures and provide functionality of a physical computer. Virtual machines allow users to run other operating systems.