Computers and the Internet Flashcards
(233 cards)
When may polling be preferable?
Polling may be efficient if:
- The controller and the device are fast
- The I/O rate is high
- Some I/O data can be ignored
- The CPU has nothing better to do
Explain Large Data Transfers in Devices
-Some devices (e.g., disk drives) will often do large data transfers
-The transfer will be inefficient if the CPU has to feed data, byte by
byte, to the controller’s registers
- A better approach is to offload this work to a special-purpose
processor (a direct memory access (DMA) controller)
What are device drivers?
A device driver hides differences between various device controllers by defining an interface between the OS and I/O devices for a specific class of I/O devices.
What is Direct Memory Access?
-The CPU writes command block into memory, specifying source and destination of transfer
-The DMA controller can then perform multiple transfers via a single command
-When the transfer is complete, the CPU receives an interrupt from the DMA controller
-This enables the CPU to spend more resources on other tasks
What are System Calls?
A request of a kernel service.
What is a Character I/O
(Examples: keyboards, computer mice, microphones, speakers)
- A character device transfers byte one by one
- Characters must be processed in order that they arrive in the
stream
What does Character I/O interface include?
The interface includes
- Get operation, to return the next character in the stream
- Put operation, to add character to stream
- Libraries for line-by-line access, with integrated editing services (e.g.,
use back spaces to remove the preceding character from the
stream)
What is Block I/O?
Block devices (typically non-volatile mass storage devices) are used to transfer blocks of data.
They are high volume devices
What does Block I/O interface include?
The interface includes:
- Read operation, for reading blocks of data
- Write operation, for writing blocks of data
How does does Block I/O access Memory-Mapped Files?
Layered on top of block device drivers
Rather read/write, it provides access to disk storage via a location in main memory
The OS deals with transferring data between memory and the device and can perform transfers when needed
What does a network socket interface have system calls for?
- Creating and connecting sockets
- Sending and receiving packets over the connection
- Select function, for determining the status of one or more sockets
(whether the socket is ready for reading or writing )
What is the main difference between network I/O device and other I/O devices?
With network I/O devices things routinely go wrong (missing packets, etc.)
Therefore, there need to be a system functions for:
- Checking whether a transfer was successful
- Recovering gracefully from unsuccessful transfers
Define a program
A set of instructions for performing a specific task and is stored on a disk (passive)
Define a process
An instance of a program, in execution (active) - requires CPU resources, memory and I/O
Multiple process instances of one program
Why use processes?
Modularity:
- Simplifies OS development and maintenance
Speedup through Parallelism:
- Execute multiple processes in parallel using multiple CPU cores
Security and Stability through Isolation:
- Usually, each process operates in its own memory space
- Minimize inter-process disruptions – problems in a process may not
affect others
What is a Process Control Block (PCB) ?
A PCB is a data structures that stores all the information about a process
- Kernel’s representation of a process
How does Context Switching work?
Stop running process 1 and start process 2:
- Change the state of process 1 from running to ready
- Save the context of process 1
- Load the context of process 2
- Change the process scheduling state of process 2
What is the tradeoff of Context Switches?
With too few context switches
- No fairness between processes – some processes may have to wait for a long time
With too many context switches
- The processor will spend too much resources on overhead
Key info about the stack structure
LIFO structure
Operations: Push and Pop
Function Call: Activation record (parameters, local variables, return address) pushed to stack
Function Return: Activation record popped from stack
Key info about the heap structure
- Dynamically allocated like the stack
- Blocks of memory are allocated and removed in an arbitrary order
Used when you need:
- To store a large block of memory for a longer period of time
- Variables that can change size dynamically
What is Process Hierarchy?
In Unix-like systems there is a hierarchy of processes
What is process spawning?
The method by which a process (parent) creates a new process (child)
- In linux there are 4 system calls for process spawning:
- fork()
- wait()
- exec()
- exit()
Define a Preliminary
- A process is a program in execution
-Processes change their state over the process lifecycle
What is a process scheduler?
Process schedular allocates CPU time to various processes