Midterm 1 Flashcards
What is an operating system?
Hard to define precisely, but basically allows other programs and people to make the hardware useful
What does a modern OS do?
Provides abstractions
Provides standard interface
Mediates resource usage
Consume resources
What three parts make up the operating systems?
Kernel – schedules programs the user wants to run
Userspace – allows a person to run programs
What types of things should the kernel do?
Interrupt handlers
Scheduler – who is currently on the block
(This is the part of the OS always in memory)
True or false. Tasks and processes are the same
True
However, multitasking and multiprocessing are different
What is a shell?
A task that functions as an interface between the user and an operating system, or an interface between programs.
If we have the option to use #define (preprocessor) or the compiler, which should we use?
Compiler
Compiler variable will always take less than or equal to the memory of the #define variable. Errors with the variable will also be very confusing if its done with the preprocessor.
What does on OS pass to an new task’s main function?
Two variables, argc and argv
argc is the size of the argv array and it can never be zero
What is required of the “host” for our OS to work properly?
Non-blocking access to an input (keyboard) character
An assembly instruction to change the computer’s stack pointer
What is a systems program?
Program associated with the OS
What is an applications program?
Program not associated with the OS
What is middleware?
Not an OS, not an application, its in the middle
Additional frameworks for developers
Another level of abstraction between the application and the OS
Code that might protect me, do multiple actions on a single commands, etc
What is firmware?
Hardware initialization software
What is a bootstrap program?
Initial program executed on PU (physical unit)
What is a daemon?
Kernel associated services
What is a device driver?
Device controller software
What is asymmetric multiprocessing? Symmetric multiprocessing?
Each processor is assigned as specific task in asymmetric multiprocessing
Symmetric multiprocessing is when any processor can do any task, or in other words, they use the same shared memory
What is a processor?
Controls the operation of the computer and performs its data processing functions. When there is only one processor, it is often referred to as the central processing unit (CPU).
What is main memory?
Stores data and programs. This memory is typically volatile; that is, when the computer is shut down, the contents of the memory are lost. In contrast, the contents of disk memory are retained even when the computer system is shut down. Main memory is also referred to as real memory or primary memory.
What are I/O modules?
They move data between the computer and its external environment. The external environment consists of a variety of devices, including secondary memory devices (e.g., disks), communications equipment, and terminals.
What is the system bus?
Provides for communication among processors, main memory, and I/O modules.
What is a chip?
Also called a socket, it contains multiple processors (called cores), which each have multiple threads to work on.
What is an instruction cycle?
The processing required for the fetching and execution of a single instruction
What is the PC?
Program counter
Holds the address of the next instruction to be executed. Goes sequentially throughout the program, fetching an instruction, storing it in the IR, and executing. The bits stored in the IR tell the computer what to do.
In general, what are the four categories processor instructions fall into?
Processor-memory: Data may be transferred from processor to memory or from memory to processor.
Processor-I/O: Data may be transferred to or from a peripheral device by transferring between the processor and an I/O module.
Data processing: The processor may perform some arithmetic or logic operation on data.
Control: 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.
An instruction can also do a combination of the above actions
How does a processor handle multiple interrupts?
1) On execution of one interrupt, interrupts become disabled. Right before returning to normal execution of instructions, interrupts are enabled again to process the rest. Interrupts are processed in sequential order this way (doesn’t set priorities).
2) Gives interrupts priority. Interrupts are executed but higher interrupts can interrupt those and take over. Before returning to the user program, an interrupt with higher priority than the user program will stop it and execute before returning to the program.
What is a signal?
Asynchronous event notification to a process or multiple processes that something needs to be done. A software interrupt. Anybody can signal – hardware or software.
When is a signal acknowledged?
When the signal is unblocked
How are signals delivered to a process?
Every process has a signal variable. If a signal bit is set, it does the appropriate operation. Checks the signal bit every time the program does a context switch, which should be often.
What operations are illegal within a signal handler?
Blocking operations
How are parameters passed to a signal?
You can pass them through environment variables
What signals might a process not handle?
Harmless signals like SIGSTOP
How many signals might a signal support?
Usually 64, 1 per bit in the signal variable
What is the difference between an interrupt and a trap?
An interrupt is coded while a trap is caused by hardware. A trap happens when, for example, an exception needs to be thrown.
Traps also deal with the current line of code being executed, like when there is an error with it. An interrupt does not have to do with the next line of code to be executed, but simply jumps to do something else.
What is the purpose of an interrupt?
It allows the computer to run more efficiently. For example, if relatively slow hardware needs to do a subtask before it can use the next piece of information, an interrupt can leave the task behind to do something else while the hardware finishes. It will then return to finish the task.
What is the purpose of interrupts intentionally coded into a user program?
It gives a person more control over the computer. A user can make custom interrupt handlers to do specific things.
Describe spatial and temporal locality. What are these ideas used for?
Spatial locality is the idea that if one point in memory is accessed, it is more likely that memory in close proximity around it will also be accessed soon.
Temporal locality is the idea that if something is accessed in memory now, it will likely be accessed again in the near future.
How do caches take advantage of spatial and temporal locality?
For spatial locality, if a memory point is accessed, the cache will store a whole block of memory around the accessed point instead of just the one variable in anticipation that those other points will be used soon.
Temporal locality is the same, except this only applies to the accessed variable in anticipation of the same variable to be called again in the near future.
What are the 3 tradeoff relationships when it comes to memory and access speed?
Faster access time, greater cost per bit
Greater memory capacity, lower cost per bit
Greater memory capacity, slower access time
What memory structures make up inboard memory?
Registers – highest speed, smallest capacity
Cache – higher speed, smaller capacity
Main memory – slower speed, higher capacity
What three section are there in the memory hierarchy?
Inboard memory
Outboard storage
Off-line storage
What kinds of things comprise outboard storage?
CD’s
External hard drives
What does SMP stand for? What is it?
Symmetric multiprocessor
It is a computer with these characteristics:
1) Has 2 or more processors with comparable capabilities
2) The processors share the same main memory and I/O facilities and are connected such that they can access things in similar time
3) They share access to I/O devices
4) All processors can perform the same functions (symmetric)
5) The system is control by an OS that provides interaction between the processors at data element levels (other systems can only interact at file level for example)
What benefits does an SMP have over a uniprocessor?
Better performance
Availability – if one processor fails, the system still functions (with a drop in performance from the lost processor)
Incremental growth – can add another processor for better performance
Scaling – vendors can offer better computers for more money by increasing processors implemented
What are the three main objectives of an operating system?
Convenience – make the computer more convenient to use
Efficiency – use the resources the most efficient way possible
Ability to evolve – can add more functionality if desired
List some services an operating system provides
Program development, program execution, access to I/O devices (easy reads and writes without knowing complex details of the I/O device), controlled access to files and the system, error detection and response, accounting (like a task manager), ISA, ABI, API.
Why will a major OS evolve over time?
New types of hardware or hardware upgrades
New services
Fixes
Map the “new building construction” components to the computer components, namely the builder (general contractor), workers, materials, tools, and the new building.
Builder (general contractor) – operating system
Workers – Threads, cores/processors times threads per processor
Materials – Resources
Tools – Libraries
New building – task or process (or carrying them out I suppose)