Eksamen Flashcards
Hvad er en proces?
Et program med alt dens tilhørende data.
Local data:
address space, heap, open files, process-ID, parent, ownership, CPU reg. (copy)
Hvad er et program?
Et sæt instruktioner i maskinkode.
- Instruktionssekvens (objektkode).
- Oftest en fil.
- Statisk.
Hvad er en tråd?
Den mindste eksekverbare del af en proces.
Local data:
thread-ID, priority, stack.
What’s the order of the memory hierarchy?
What are the basic elements in a computer system
- Processor
- Main Memory
- I/O Modules
- System Bus
What components can be found in a processor/CPU
PC - Program counter
IR - Instruction register
MAR - Memory address register
MBR - Memory buffer register
I/O AR - input/output address register
I/O BR - input/output buffer register
Execution Unit
What is an Execution Unit?
The part of a CPU that:
- Does some arithmetic operation.
- Sets flags according to a comparison.
- Moves a value from one register to another.
What does a processor do?
It controls the operation of the computer and performs its data processing functions.
*When there is only one processor, it is often called a Central Processing Unit(CPU)
What does Main Memory do?
It stores data and programs.
This memory is typically volatile (when the computer shuts down the content of the memory is lost).
Main memory is also called primary memory or RAM.
What does I/O Modules do?
- They move data between the computer and its external environtment.
- They contain internal buffers for temporarily holding data until it can be sent on.
The external environtment consists of a variety of devices, including secondary memory devices (e.g., disks), communications equipment, and terminals.
What does the System Bus do?
It provides for communication among processors, main memory, and I/O modules.
What does a processor use to exchange data with main memory?
It uses two internal registers:
MAR (memory adress register)
MBR (memory buffer register)
What does the MAR (memory adress register) contain?
The adress in memory for the next read or write instruction.
What does MBR (memory buffer register) contain?
The data to be written into or which receives the data from from memory.
What does an I/OAR do?
It specifies a particular I/O device.
What does an I/OBR (input output buffer register) do?
It is used for the exchang of data between an I/O module and the processor.
What does DSP stand for?
And what does it do?
Digital Signal Processor
Deals with streaming signals - such as audio & video.
What is an instruction cycle?
The processing required for a single instruction. Fetching and then executing.
Which steps does a instruction cycle consist of?
- Instruction fetch
- Instruction execution
- Check for interrupts
- HALT (error stage)
What is a program execution?
A repetition of instruction execution.
A fetched instruction is loaded into what register?
IR (Instruction register)
Which four distinct actions can a machine instruction specify?
- Processor-memory action.
- Processor-I/O action.
- Data Processing action.
- Control action.
What is a processor-memory action?
Data is transferred from processor to memory or vice versa.
What is an Processor-I/O action?
Data is transferred to or from a peripheral device by transferring between the processor and an I/O module.
What is a Data processing action?
The processor performs some arithmetric or logical operation on data.
What is a Control action?
An instruction may specify that the sequence of execution be altered.
For example: The processor may fetch an instruction from location 149, which specifies that the next instruction will be from location 182. The processor sets the program counter to 182. Thus, on the next fetch stage, the instruction will be fetched from location 182 rather than 150.
What is an interrupt?
A message which interrupts the current program to do something else, after which it will return to where it was interrupted.
How are multipe interrupts dealt with?
There are two ways to deal with it:
- Sequential interrupt processing (also called a disabled interrupt)
- Ignores all interrupts until this one is done.
- Nested interrupt processing.
- If an interrupt is received while another interrupt is being handled, the newest interrupt will take priority.
What is Cache memory?
It is a device for staging the movement of data between main memory and processor registers to improve performance.
What is SMP (Symmetric Multiprocessing)?
SMP (symmetric multiprocessing) is the processing of programs by multiple processors that share a common operating system and memory.
What is a core?
When there are multiple processors inside the same chip.
(They each have their individual cache storages, but also share at least one cache that is accessible by all of them.)
What is the difference between a multiprocessor and a multicore?
Multiprocessors doesn’t share a cache and are not in the same chip but multicores do.
What is spatial locality?
If a particular memory location is referenced at a particular time, then it is likely that nearby memory locations will be referenced in the near future.
In this case it is common to attempt to guess the size and shape of the area around the current reference for which it is worthwhile to prepare faster access.
What is temporal locality?
If memory has been accessed recently it is already in cache and is therefore fast to use again.
What is an instruction trace?
A listing of a sequence of instructions.
What is a Batch Job?
A batch job is a computer program or set of programs processed in batch mode. This means that a sequence of commands to be executed by the operating system is listed in a file (often called a batch file, command file, orshell script) and submitted for execution as a single unit.
What is interactive log-on?
A user at a terminal logs on to the system.
What are the five states in the five state process model?
- New.
- Ready.
- Running.
- Blocked/Waiting.
- Exit.
What does the blocked/waiting state mean in the five state process model?
A process that cannot execute until some event occours, like the completion of I/O operation.
What does the new state mean?
A process that has just been created, but has not yet been admitted to the pool of executable processes by the OS.
Typically, a new process has not yet been loaded into the main memory, although its process control block has been created.
What does the Exit state mean?
A process is in the Exit State when it has been released from the pool of executeable processes by the OS.
Either because it halted or because it aborted for some reason.
What is preemption?
Preemption is defined to be the claiming of a ressource from another process that is using it.
What is swapping and what is its purpose?
When none of the processes in main memory is in the Ready state, the OS swaps one of the blocked processes from the disk into a suspend queue.
What is concurrency?
Concurrency is when two tasks can start, run, and complete in overlapping time periods. It doesn’t necessarily mean they’ll ever both be running at the same instant. Eg. multitasking on a single-core machine.
Can be implemented using software such as an OS or Virtualization software
What is paralellism?
Parallelism is when tasks literally run at the same time, eg. on a multicore processor.
To implement parallelism hardware such as a multicore processor is needed.
What is an atomic operation?
A function or action implemented as a sequence of one or more instructions that appears to be indivisible.
The sequence of instructions is guaranteed to execute as a group.
Atomicity guarantees isolation from concurrent processes.
What is a Critical Region/Section?
Code region that is vulnerable to race conditions by accessing shared resources
What is deadlock?
A collection of threads P are in a deadlock state if every thread in P is waiting for an event that can only be generated by another thread in P.
What is livelock?
Deadlock-like state with no progress although with no cyclic wait.
What is mutual exclusion?
The requirement that when one process is in a critical region that accesses shared ressources, no other process may be in a critical region that accesses any of those shared ressources.
How can you ensure mutual exclusion?
There are three ways:
- Disabling interrupts
- Pro’s: effective.
- Con’s: too effective, potentially very disruptive.
- Software locks
- Pro’s: portable, less disruptive.
- Con’s: inefficient, vulnerable to compiler optimisation.
- Hardware locks
- Pro’s: (more) efficient
- Con’s: less portable… still inefficient(!)
Interrupts: What is a software/hardware lock?
In computer science, a lock or mutex (from mutual exclusion) is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. A lock is designed to enforce a mutual exclusion concurrency control policy.
What is a race condition?
A situation in which multiple threads or processes read and write a shared data item and the final result depends on the relative timing of their execution.
What is starvation?
- Situation where a thread never acquires a resource because other processes always get it first.
- Typical problem for systems with priorities.
What are Priorities?
Priorities are the measurement of the relative importance of the task.
- Hard real-time tasks may have an “absolute” priority, with the system failing if a deadline is missed.
- If the system is to continue to run no matter what, then both hard and soft real-time tasks may be assigned relative priorities as a guide to the scheduler.
What is a semaphore?
A semaphore is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a parallel programming or a multi user environment.
A useful way to think of a semaphore is as a record of how many units of a particular resource are available, coupled with operations to safely (i.e., without race conditions) adjust that record
- Semaphores which allow an arbitrary resource count are called counting semaphores
- Semaphores which are restricted to the values 0 and 1 (or locked/unlocked, unavailable/available) are called binary semaphores.
What is a mutex?
A (very) simple semaphor.
- Two states (binary): locked and unlocked.
- lock: locks an unlocked mutex.
- unlock: unlocks a locked mutex.
What is a condition variable?
A data type that is used to block a process or thread until a particular condition is true.
What is a monitor?
- Language construct ensuring mutual exclusion.
- Encapsulates critical regions.
- Guaranteed by the compiler.
What is a spinlock?
Mutual exclusion mechanism in which a process executes in an loop waiting for the value of a lock variable to indicate availability.
What are event flags?
An event flag is a process synchronization primitive.
It has two possible states: “set” or “cleared”.
What requirements is memory management intended to satisfy?
- Relocation
- Protection
- Sharing
- Logical organization
- Physical organization
Memory management: What is Relocation?
Processes should be able to be relocated everywhere in memory and still work. This raises technical concerns related to adressing
Memory management: What is protection?
A process cannot be allowed to access other processes data.
Memory management: What is Sharing?
Despite protection, we can still allow processes to access shared data.
Memory management: What is logical organization?
Main memory is organized as a linear or one-dimensional address space that consists of sequence of bytes or words. Secondary memory at its physical level is similarly organized. Most of the programs are organized into modules.
Memory management: What is Physical organization?
Computer memory is organized into two levels:
- Main memory - Main memory is a volatile memory and it provides fast access at relatively high cost.
- Secondary memory - Secondary memory is a non-volatile memory and it is slower and cheaper than main memory.
Why is it impossible to enforce memory protection at compile time?
Because it’s impossible to know how many ressources a process needs before runtime.
What are some reasons to allow two or more processes to all have access to a particurlar region of memory?
For example if a number of processes are executing the same program it is advantageous to allow each process to access the same copy of the program rather than have its own separate copy.
What are the advantages of using unequal-size partitions in a fixed-partitioning scheme?
It creates less internal fragmentation because you get a memory block which fits better to the size you need.