CPSC 351 Study Guide
The hardware/user gap is bridged by the OS or by other system software. Which of the following tasks would require OS support and why?
-Input a character from the keyboard (hardware -> application program) -allocate n bytes of memory for a new data structure (resource allocator) -load a program into memory (software -> hardware gap) -call a library function (hardware -> software) -exit current program (controls execution of program) -sleep for n second (privileged instruction, must have OS perform on behalf of process)
Fork steps:
1. Create and initialize the process control block (PCB) in the kernel. 2. Create a new address space 3. Initialize the address space with a copy of the entire contents of the address space of the parent 4. Inherit the execution context of the parent (e.g., any open files). 5. Inform the scheduler that the new process is ready to run.
CreateProcess steps:
1. Create and initialize the process control block (PCB) in the kernel. 2. Create and initialize a new address space. 3. Load the program prog into the address space. 4. Copy arguments args into memory in the address space. 5. Initialize the hardware context to start execution at "start". 6. Inform the scheduler that the new process is ready to run.
What is an operating system?
A program that: Runs at all times (a.k.a. a resident monitor, a.k.a. kernel) Manages computer hardware resources. Provides a basis for application programs. Acts as an intermediary between user and hardware. No completely adequate definition. An interface for users and applications to interact with hardware.
____ that acquired the lock can release the lock on a mutex. A) Only the thread/process B) Any thread/process C) Main thread/parent process D) The child thread/child process E) Only user of OS
A) Only the thread/process
Benefits of multi-threading A) Resource usage B) Increased interrupts C) Unsuitability D) Reduced procrastination E) Reduced interrupts F) Response time G) Cost-saving H) Scalability
A) Resource usage F) Response time G) Cost-saving H) Scalability
This ___ concept is like a library which has 10 copies of C++ books that 10 students can borrow. the first 10 that come to the library looking for a copy one will get one, but the 11th believe I have to wait or come back later. A) semaphore B) mutex C) critical section D) race condition E) process synchronization
A) semaphore
If the lock is not help very often and/or is only held for a very short periods time for a small code blocks/statements. It is better to use _____. A) spinlock B) semaphore C) mutex D) process synchronization
A) spinlock
The need for a lock is ______ A) to protect access to a shared resource B) to increase race conditions. C) to allow multiprogramming D) to decrease context switch time
A) to protect access to a shared resource
How does process request services from OS? A) via system call B) via phone call C) via function call D) Interrupt F) via CPU
A) via system call
OS is an interrupt driven software.
Agree
What is an API
Application programming interface. Allows programmers to access routines/protocols/resources in a specified manner.
This PPT is a A) Program B) Process
B) process
Software interrupt can happen during____ Select all that apply. A) Request for operating system service - example fork() system call. B) Infinite loop C) All of these D) IO request E) Software error (e.g., division by zero)
C) All of these
A thread shares process' resources with... A) other processes B) other similar thread across the system C) other threads within the same process D) other threads inside similar processes E) with no one.
C) other threads within the same process
Small, fast emory located between the processor and main memory is called:
Cache memory
_______ is copying information into faster storage system; main memory can be viewed as a cache for secondary storage.
Caching
___________ is more efficient than interrupt-driven or programmed I/O for a multiple-word I/O transfer.
Direct memory access
Symmetric multiprocessing (SMP)
Each processor is self-scheduling, all processes in common ready queue, or each has its own private queue of ready processes.
It is not the responsibility of the operating system to control the execution of processes. (T/F)
F
A context switch may occur at any time, that means the OS has gained control from the currently running process. (T/F)
F (Maybe)
A system bus transfers data between the computer and its external environment. (T/F)
False
An SMP can be defined as a stand-alone computer system with two or more similar processors of comparable capability. (T/F)
False
By design, threads can only execute different functions/parts of the program code at the same time. (T/F)
False
It is not possible for a communications interrupt to occur while a printer interrupt is being processed. (T/F)
False
Over the years memory access speed has consistently increased more rapidly than processor speed. (T/F)
False
Suppose there are 2 Thread 1 and Thread 2 both are executing at the same time on 2 different CPUs. This is an example of concurrency. (T/F)
False
Threads can run concurrently but not in parallel. (T/F)
False
Threads cannot be context switch only process. (T/F)
False
With interrupts, the processor can not be engaged in executing other instructions while an I/O operation is in progress. (T/F)
False
the fetched instruction is loaded into the Program Counter. (T/F)
False
Process memory space is protected by the program itself. (T/F)
False (Maybe)
What is a system call?
Functions which processes can use to request services from the operating system such as:Read file from the diskSend data over the network Send message to another process
How does the distinction between kernel mode and user mode function as a rudimentary form of protection (security system)?
If process tries to do a privileged instruction, attempt will be prevented because it is in user mode
The fetched instruction is loaded into the __________.
Instruction Register (IR)
Load balancing
It attempts to keep workload evenly distributed
What services does it provide?
It provides the means for proper use of system resources e.g. hardware, software, and data.
What is the job of the OS with respect to memory management?
Keep track of what parts of memory are being used by what processes. Decide which processes (or parts of) to move into and out of memory. Allocate and deallocate memory as needed. Work with main memory - A large array of bytes or words where each word or byte has its own address.
In the operating system is the one program running at all times on the computer called the ______.
Kernel
Asymmetric multiprocessing
Only one processor accesses the system data structures, alleviating the need for data sharing.
Push migration
Periodic task checks load on each processor, and if found pushes task from overloaded CPU to other CPUs
The four main structural elements of a computer system are:
Processor, Main Memory, I/O Modules and System Bus
A Control/Status register that contains the address of the next instruction to be fetched is called the _________.
Program Counter (PC)
The _______________ holds the address of the next instruction to be fetched.
Program Counter (PC)
What is the difference between a program and a process?
Program: is a passive entity, a set of instructions, and a potential of processes. Process: is an active entity and requires system resources for its operation. Process: is the execution of a program and is a unit of work within the system.
What are the three main purposes of an operating system?
Resource allocator, provide a basis for application programs, acts as an intermediary between user and computer hardware
To satisfy the requirements of handheld devices, the classic microprocessor is giving way to the ___________, where not just the CPUs and caches are on the same chip, but also many of the other components of the system, such as DSPs, GPUs, I/O devices and main memory.
System on a Chip (SoC)
The program counter indicates the address of the next instruction to be executed for this process. (T/F)
T
A preemptive process is be more responsive (T/F) (20 points)
T (Maybe)
In a uniprocessor system, multiprogramming increases processor efficiency by:
Taking advantage of time wasted by long wait interrupt handling
Application Programming Interface (API)
The API specifies a set of functions that are available to an application programmer, including the parameters that are passed to each function and the return values the programmer can expect. Without API we can't access certain data (metadata).
What is caching?
The technique of moving information to a temporary more accessible location for quicker use
A process is a grouping of resources: an address space, open files, signal handlers, and one or more threads. A thread is just an execution unit. (T/F)
True
An example of a multicore system is the Intel core i7. (T/F)
True
Dual-mode operation allows OS to protect itself and other system components, contains 2 modes: user mode and kernel mode. (T/F)
True
For each process there can be many threads. (T/F)
True
I/O and CPU can execute concurrently (True or false)
True
If one user-level thread is blocked on an OS system call, the other user-level threads will be blocked as well. (T/F)
True
Interrupts are provided primarily as a way to improve processor utilization. (T/F)
True
It takes less time to switch between threads than processes. (T/F)
True
One of principal functions of the OS is to create, manage, and terminate processes. (T/F)
True
The advantage of using layers of abstraction is that you can focus on the details of any given layer without losing sight of the other layers. (T/F)
True
The interrupt can occur at any time and therefore at any point in the execution of a user program. (T/F)
True
The processor controls the operation of the computer and performs its data processing functions. (T/F)
True
The user communicates with the application program, the application program communicates with the operating system, and the operating system communicates with the hardware. (T/F)
True
Threads cannot exists without a process but the process can exist without threads. (T/F)
True
Three different types of models relate user and kernel threads. The many- to-one model maps many user threads to a single kernel thread. The one-to-one model maps each user thread to a corresponding kernel thread. The many-to-many model multiplexes many user threads to a smaller or equal number of kernel threads. (T/F)
True
Windows uses of a kernel-level thread approach. (T/F)
True
Thread has its own PC, program counter. (T/F)
True, because it needs to know what it's working on.
What is cache consistency problem?
When two or more copies of data exist in different processor's memory. May lead to different values of the same variables.Must ensure data consistency along all levels of the hierarchy.
Each location in Main Memory contains a ______________ value that can be interpreted as either an instruction or data.
binary number
The unit of data exchanged between cache and main memory is ___________.
block size
A small piece of code known as the _________ locates the kernel, loads it into main memory, and starts its execution
bootstrap program
The ____________ is a device for staging the movement of data between main memory and processor registers to improve performance and is not usually visible to the programmer or processor.
cache
Instruction processing consists of two steps:
fetch and execute
How does the OS help manage I/O (i.e., device queues, etc)?
hide the peculiarities of specific devices from the user. The Unix I/O subsystem provides: 1) Functionality to manage data buffering, caching, and spooling. 2) A general device driver interface. 3) Drivers for specific hardware devices (which know how to control the specific device). The technique of moving information to a temporary more accessible location for quicker use
What is a bootstrap program?
initializes all aspects of system, loads OS kernel and starts execution at power-up
The processing required for a single instruction is called a(n) _________ cycle.
instruction
When an external device becomes ready to be serviced by the processor the device sends a(n) __________ signal to the processor.
interrupt
The _____________ routine determines the nature of the interrupt and performs whatever actions are needed.
interrupt handler
When an external devices is ready to accept more data from the processor, the I/O module for that external device sends an ____________ signal to the processor.
interrupt request
The _______________ contains the data to be written into memory and receives the data read from memory.
memory buffer register
The _________ chooses which block to replace when a new block is to be loaded into the cache and the cache already has all slots filled with other blocks.
memory controller
In the invention of the ____________ was the hardware revolution that brought about desktop and handheld computing.
microprocessor
A _____________ computer combines two or more processors on a single piece of silicon.
multicore
The concept of multiple programs taking turns in execution is known as __________________.
multiprogramming
One mechanism Intel uses to make its caches more effective is ___________, in which the hardware examines memory access patterns and attempts to fill the caches speculatively with data that is likely to be requested soon.
prefetching
What is a system call?
request to the operating system to allow user to wait for I/O completion
External, nonvolatile memory is also referred to as _____________ or auxiliary memory.
secondary memory
Parameters also can be placed, or pushed, onto the ______ by the program and popped off the ________ by the operating system.
stack
A special type of address register required by a s system that implements user visible stack addressing is called a ________________.
stack pointer
In a ______________ multiprocessor all processors can perform the same functions so the failure of a single processor does not halt the machine.
symmetric
A _______ organization has a number of potential advantages over a uniprocessor organization including performances, availability, incremental growth, and scaling.
symmetric multiprocessor
What is the kernel?
the one program running at all times on the computer
File Management
◦ create file, delete file ◦ open, close ◦ read, write, reposition ◦ get file attributes, set file attributes
Communications
◦ create, delete communication connection ◦ send, receive messages ◦ transfer status information ◦ attach or detach remote devices
Protection
◦ get file permissions ◦ set file permissions
Information Maintenance
◦ get time or date, set time or date ◦ get system data, set system data ◦ get process, file, or device attributes ◦ set process, file, or device attributes
Device Management
◦ request device, release device ◦ read, write, reposition ◦ get device attributes, set device attributes ◦ logically attach or detach devices
Process Control
◦create process, terminate process ◦load, execute ◦get process attributes, set process attributes ◦wait event, signal event ◦allocate and free memory