Exam 1 Flashcards

1
Q

What are the 4 main elements of a computer?

A

1) Processor (CPU)
2) Primary Storage (RAM)
3) I/O Module
4) System interconnection (bus)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the processor (CPU) element of a computer?

A

controls the operation of the computer and performs its data processing functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the Primary Storage (RAM) element of a computer?

A
  • stores data and programs

- typically volatile memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the I/O Module element of a computer?

A
  • moves data between the computer and its external environments
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the system bus element of a computer?

A

provides for communication among processors, main memory, and I/O modules

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 2 main processor registers?

A

1) General Purpose (User-Visible) Registers

2) Control and Status Registers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are General Purpose (User-Visible) Registers?

A
  • available to both OS and user programs

- hold operands, results, and addresses

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are Control and Status Registers?

A
  • not directly available to user programs

- used by CPU to control its own operation and to control program execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Program Counter (PC)?

A
  • control and status register

- address of the next instruction to be fetched

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the Instruction Register (IR)?

A
  • control and status register

- instruction most recently fetched

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Program Status Word (PSW)?

A
  • control and status register
  • contains status info:
    a) condition code bits (zero flag, sign flag, etc.)
    b) supervisor/user mode bit
    c) interrupt enable/disable bit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the 4 types of instructions?

A

1) Data Movement: transfer data from RAM to CPU (load) or from CPU to RAM (store)
2) Data Manipulation: perform arithmetic or logic operations on data
3) Control Transfer: alter the execution sequence of the program
4) Other: special purpose

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is an interrupt?

A
  • fundamental to operation of modern computers and integral part of OS design
  • Mechanism to allow other modules to interrupt CPU
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the 2 main strategies for handling multiple interrupts?

A

1) Sequential interrupt processing

2) Nested interrupt processing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is Sequential interrupt processing?

A

disables all other interrupts while processing the current interrupt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is Nested interrupt processing?

A

allows processing in priority order (each type of interrupt is assigned a relative priority)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are some examples of classes of interrupts?

A
  • hardware failure (ex: memory parity error)
  • Timer (ex: time slice completed)
  • I/O (ex: operation completed)
  • Program Exception (ex: divide by zero)
  • Program Trap: (control transfer instruction to request interrupt)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

As one goes down the memory hierarchy, what occurs?

A
  • Decreasing cost per bit
  • Increasing capacity
  • Increasing access time
  • Decreasing frequency of access to the memory by the processor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is DMA (Direct Memory Access)?

A

Allow I/O modules to transfer blocks of bytes into (or out of) RAM without using the CPU to copy the bytes

  • CPU initiates I/O operation
  • I/O module starts processing
  • CPU used for other purposes
  • I/O uses interrupt to signal completion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is cache memory?

A
  • small cache of expensive but very fast memory interacting with slower but much larger memory
  • processor first checks if word referenced to is in cache
  • if not found in cache, a block of memory containing the word is moved to the cache
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the Locality of Reference?

A
  • memory references for both instructions and data values tend to cluster over a long period of time
  • ex: once a loop is entered, there is frequent access to a small set of instructions
  • hence: once a byte gets referenced, it is likely that nearby bytes will get referenced often in the near future
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are the differences between a multicore and a multiprocessor system?

A

multicore: is having multiple processing cores on the same chip, essentially multiple CPUs on one bit on silicon
multiprocessor: is having 2 or more separate CPUs in a machine

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the distinction between spatial locality and temporal locality?

A

Spatial locality: refers to the tendency of execution to involve a number of memory locations that are clustered
Temporal locality: refers to the tendency for a processor to access memory locations that have been used recently

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

In general, what are the strategies for exploiting spatial and temporal locality?

A

Spatial locality: exploited by using larger cache blocks and by incorporating prefetching mechanisms into the cache control
Temporal locality: exploited by keeping recent used instructions and data values in cache memory and by exploiting a cache hierarchy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are the 3 objectives of OS design?

A

1) Convenience
2) Efficiency
3) Ability to evolve

26
Q

What is the kernel of an OS?

A

contains the most frequently used functions in the OS and, at a given time, other portions of the OS currently in use

27
Q

What is microprogramming?

A

– a.k.a., time sharing, multitasking
– Sharing a resource (e.g., computer) among users, such that each seems to have the whole machine
– Pauses by one user filled with work for another
– Need to store program state, quickly switch among user applications
– Key mechanism: interrupts

28
Q

What is a process?

A
  • a program in execution
  • an instance of a program running on a computer
  • the entity that can be assigned to and executed on a processor
  • A unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources
29
Q

List and briefly explain five storage management responsibilities of a typical OS.

A

1) Process isolation: The OS must prevent independent processes from interfering with each other’s memory, both data and instructions
2) Automatic allocation and management: Programs should be dynamically allocated across the memory hierarchy as required
3) Support of modular programming: Programmers should be able to define program modules, and to create, destroy, and alter the size of modules dynamically
4) Protection and access control: sharing of memory, at any level of the memory hierarchy, creates the potential for one program to address the memory space of another
5) Long-term storage: Many application programs require means for storing information for extended periods of time, after the computer has been powered down

30
Q

Explain the difference between a real address and a virtual address

A

real address: the physical address in main memory

virtual address: consists of a page number and an offset within the page

31
Q

Explain the difference between a monolithic kernel and a microkernel

A

monolithic kernel: kernel provides most OS services

microkernel: kernel provides as little as possible; user-level servers provide most OS services

32
Q

What is multithreading?

A

a technique in which a process, executing an application, is divided into threads that can run concurrently

33
Q

What is an instruction trace?

A

characterizes the behavior of an individual process by listing the sequence of instructions that execute for that process

34
Q

What does it mean to preempt a process?

A

the reclaiming of a resource from a process before the process has finished using it

35
Q

What is swapping and what is its purpose?

A
  • involves moving part of all of a process from main memory to the disk
  • purpose is to enhance performance
36
Q

What are the 4 characteristics of a suspended process?

A

1) The process is not immediately available for execution
2) The process may or may not be waiting on an event. If it is, this blocked condition is independent of the suspend condition, and occurrence of the blocking event does not enable the process to be executed immediately
3) The process was placed in a suspended state by an agent; either itself, a parent process, or the OS, for the purpose of preventing its execution
4) The process may not be removed from this state until the agent explicitly orders the removal

37
Q

For what types of entities does the OS maintain tables of information for management purposes?

A
  • The allocation of main memory to processes
  • The allocation of secondary memory to processes
  • Any protection attributes of blocks of main or virtual memory, such as which processes may access certain shared memory regions
  • Any information needed to manage virtual memory
38
Q

What are 3 general categories of information located in a process control block?

A

1) Process Identification
2) Processor State Information
3) Process Control Information

39
Q

Why are 2 modes (user and kernel) needed?

A

It is necessary to protect the OS and key operating system tables, such as process control blocks, form interfering by user programs

40
Q

What are the steps performed by the OS to create a new process?

A

1) Assign a unique process identifier to the new process
2) Allocate space for the process
3) Initialize the process control block
4) Set the appropriate linkages
5) Create or expand other data structures

41
Q

What is the difference between an interrupt and a trap?

A

interrupt: control is first transferred to an interrupt handler
trap: OS determines if the error or exception condition is fatal. If so, the currently running process is moved to the Exit state and a process switch occurs. If not, then the action of the OS will depend on the nature of the error and design of OS

42
Q

What is a mode switch?

A
  • system switches modes (ex: user to kernel)
  • may happen when an interrupt does not result in a process switch, system needs to save the processor state information
  • faster than a process switch
43
Q

Give 4 general examples of the use of threads in a single-user multiprocessing system

A

1) Foreground and background work
2) Asynchronous processing
3) Speed of execution
4) Modular program structure

44
Q

What resources are typically shared by all of the threads of a process?

A

share the same address space and other resources, such as open files

45
Q

List 3 advantages of ULTs over KLTs

A

1) Thread switching does not require kernel mode privileges because all of the thread management data structures are within the user address space of a single process. Therefore, the process does not switch to the kernel mode to do thread management. Saves the overhead of 2 switches
2) Scheduling can be application specific. One application may benefit most from a simple round-robin scheduling algorithm, while another might benefit from a priority-based scheduling algorithm. The scheduling algorithm can be tailored to the application without disturbing the underlying OS scheduler
3) ULTs can run on any OS. No changes are required to the underlying kernel to support ULTs. The threads library is a set of application-level functions shared by all applications

46
Q

What are 2 disadvantages of ULTs over KLTs?

A

1) In a typical OS, many system calls are blocking. As a result, when a ULT executes a system call, not only is that thread blocked, but also all of the threads within the process are blocked
2) In a pure ULT strategy, a multithreaded application cannot take advantage of multiprocessing. A kernel assigns 1 process to only 1 processor at a time. Therefore only a single thread within a process can execute at a time. In effect, we have application-level multiprogramming within a single process. While this multiprogramming can result in a significant speedup of the application, there are applications that would benefit from the ability to execute portions of code simultaneously

47
Q

What is jacketing?

A

A way to overcome the disadvantages of using ULTs with the purpose of converting a blocking system call into a nonblocking system call

48
Q

What does the fork() system call do?

A

– fork() allocates entry in process table and assigns a unique PID to the child process
– child gets a copy of the process image of the parent; both child and parent are executing the same code after fork()
– fork() returns the PID of the child process to the parent process and returns 0 to the child process

49
Q

What are the benefits of using threads?

A
  • Takes less time to create a new thread than a new process
  • Less time to terminate a thread than a process
  • Less time to switch between 2 threads within the same process
  • Since threads within the same process share memory and files, they can communicate with each other without invoking the kernel
50
Q

What are advantages of KLTs?

A
  • the kernel can simultaneously schedule many threads of the same process on many processors
  • blocking is done on a thread level
  • kernel routines can be multithreaded
51
Q

What are disadvantages of KLTs?

A
  • thread switching within the same process involves the kernel
  • this results in a significant overhead
52
Q

What are 3 problems with Concurrent Execution?

A

1) Concurrent processes (or threads) often need to share data (in memory or in files)
2) Actions performed by concurrent processes depend on the order in which their execution is interleaved, which typically is not deterministic
3) Must control access to shared data (otherwise data may become corrupted)

53
Q

List 4 design issues for which the concept of concurrency is relevant

A

1) The OS must be able to keep track of the various processes. This is done with the use of process control blocks
2) The OS must allocate and deallocate various resources for each active process
3) The OS must protect the data and physical resources of each process against unintended interference by other processes. This involves techniques that relate to memory, files, and I/O devices.
4) The functioning of a process, and the output it produces, must be independent of the speed at which its execution is carried out relative to the speed other concurrent processes

54
Q

List 3 degrees of awareness between processes

A

1) Processes unaware of each other
2) Processes indirectly aware of each other
3) Processes directly aware of each other

55
Q

List the 3 control problems associated with competing processes and the briefly define each

A

1) Mutual Exclusion: at any time, only one process is allowed to execute in its critical section
2) Deadlock: processes can deadlock if both are waiting on a resource
3) Starvation: a process may be indefinitely denied access to a resource

56
Q

What operations can be performed on a semaphore?

A

1) Initialize: A semaphore may be initialized to a nonnegative integer value
2) Decrement: The semWait operation decrements the semaphore value. If the value becomes negative, then the process executing the semWait is blocked. Otherwise the process continues execution
3) Increment: The semSignal operation increments the semaphore value. If the resulting value is less than or equal to 0, then a process blocked by a semWait operation, if any, is unblocked

57
Q

What is the difference between binary and general semaphores?

A

a binary semaphore only takes on the values 0 and 1

58
Q

What is the difference between weak and strong semaphores?

A
  • a weak semaphore does not specify the order in which processes are removed from the queue
  • a strong semaphore does
59
Q

What is a monitor?

A

a programming language construct that provides equivalent functionality to that of semaphores and that is easier to control

60
Q

What is a critical section?

A

when a process executes code that manipulates shared data, we say that the process is in a critical section (CS) for that shared data

61
Q

What are problems with semaphores?

A
  • Semaphores provide a powerful tool for enforcing mutual exclusion and coordinating processes
  • But wait(s) and signal(s) are scattered among several processes. Hence, difficult to understand their effects
  • Usage must be correct in all the processes
  • One bad (or malicious) process can cause the entire collection of processes to fail