1/54
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Device Independent I/O Software (The File System)
- Has no clue how the device works, just reads and writes blocks
- Performs I/O functions common to ALL devices
- Provides a uniform interface to the user processes
What is Uniform Interfacing?
It is a data structure which contains the attributes and disk addresses of the filed data blocks (Includes major and minor device numbers)
Block Device Buffering:
The hardware reads or writes entire blocks at a time while the user only reads or writes one record at a time so a buffer is needed
Character Device Buffering:
Users Process read or writes faster than the device is able to, so a buffer is needed to keep up
Error Reporting
- Errors are handled at the lowest level possible
- The driver first tries to resolve the error
- Next up is the Device Independent Software (File System) which reports the error back to the user process and then crashes the OS using the panic() function (UNIX)
Dedicated Devices
- Some devices can be used only by one process at a time
- The OS accepts or rejects device user requests
How is this done?
- Requires an OPEN() system call, if the device is unavailable, return "open failed" code
Block Sizes:
- Not all disks have the same sector size
- Disks devices read/write data in terms of sector size
- User processes read/write records
- The Device Independent Software (File System) hides differences
How data is viewed at various levels of the I/O Software:
Users = Records
File System = Blocks or Records
Driver = Sectors/Tracks/Cylinders
Device = Bytes
-User Space I/O Software-
What are Library Procedures?
1. Open
2. Read
3. Write
4. Close
What is User Code?
1. Printf
2. Scanf
3. anything that calls the library procedures (
What are Functions?
1. Printf
2. Scanf
3. Anything that are in
Spooling deals with Dedicated I/O Devices (like a printer):
- Users place data in the printer spooling directory
- Only 1 program has access to the printer device, (printer Daemon)
Other situations a Spooler is used?
An email spooling directory and an email daemon, etc.
What makes Deadlocks possible?
When an OS can temporarily gran a process exclusive access to a certain resource/resources (i.e. hardware and software)
What is a Resource?
Anything that can be used by only 1 process at a time
Examples:
- Tape Drive
- Printer
- Database Records
What are the two types of resources we talked about?
1. Preemptable
2. Non-preemptable
What is a Preemptable Resource?
It can taken away with no ill or negative effects
What is a non-preemptable Resource?
1. Can not be taken away without causing a computation to fail
2. Note: Deadlocks involve non-preemptable resources
What is a Deadlock?
A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause
What are the Deadlock Conditions we talked about in class?
1. Mutual Exclusion Condition
2. Hold and Wait Condition
3. No Preemption Condition
4. Circular Wait Condition
What is a Mutual Exclusion Condition?
When each resource is either currently assigned to exactly one process or is available
What is a Hold and Wait Condition?
Processes currently holding resources that were granted earlier can request new resources
What is a No Preemption Condition?
Resources previously granted cannot be forcibly taken away from a process. They must be explicitly released by the process holding them
What is a Circular Wait Condition?
There must be a circular chain of two or more processes, each of which is waiting for a resource help by the next member of the chain
Deadlock Avoidance page 241-242
What is a Device Controller (Adapter)?
I/O units typically consist of a mechanical component and an electronic component. It is often possible to separate the two portions to provide a more modular and general design. The electronic component is called the Device Controller or Adapter.
What is a System Bus?
A system bus works by sharing data and other information between various aspects of the computer's hardware. Example would be USB
What is Direct Memory Access?
Instead of using the CPU to address device controllers DMA is used so no CPU time is wasted. The DMA controller has access to the system bus independent of the CPU
What is Memory-Mapped I/O?
A Scheme that involves the I/O registers being a part of the regular memory address space (Usually on top of the address space)
What is a Device Driver?
Software that acts as a translator which enhances the capabilities of the operating system by enabling it to communicate with hardware. It accepts abstract requests from the device independent software above it and see to it that the request is executed
What is an Interrupt Handler?
It is run to discover what has happened, that is, which device want attention right now. It then extracts the status from the device and wakes up the sleeping process to finish off the I/O request and let the user process continue.
What are the Deadlock Handling Strategies we talked about in class?
1. Ignore the problem altogether and maybe it will ignore you
2. Detection and recovery - Detect when a deadlock occurs and take action
3. Dynamic Avoidance - by careful resource allocation
4. Prevention - Structurally negate one of the four conditions necessary to cause a deadlock
Goals of I/O Software:
1. Device Independence
2. Uniform Naming
3. Error handling
4. Synchronous(blocking) vs asynchronous(interrupt-drive) transfers
5. Buffering
6. Shareable vs Dedicated Devices
Major Device Number:
Used to locate the appropriate driver
Minor Device Number
Used to locate the unit to be read from or written to
Layers of I/O System:
1. User Processes - Make I/O call; format I/O; Spooling
2. Device-independent Software - Naming, protection, blocking, buffering, allocation
3. Device Drivers - Set up device registers; check status
4. Interrupt Handlers - Wake up driver when I/O completed
5. Hardware - Perform I/O operation
Error handling
- Handled as close to the hardware are possible
- if the controller cannot correct an error, the device driver is next
- many errors are transient and can be fixed with repetition
- ONLY if the lower layers are not able to deal with the problem should the upper layers be told about it
Two Phase Locking:
Phase 1:
- Process tries to lock all the records it needs, one at a time
- if it succedds, it moves to phase 2
- if it fails to lock every record, it releases all locks and starts over
Phase 2:
- Updated locked DB records
- Release all locked records
How does Unix handle deadlocks?
They ignore deadlocks, only place they can occur is in shared resources
What is a terminal?
A free standing device which has a keyboard for input, a display for output, and is often connected to the computer by a wire or more typically by using a modem
What is a terminal driver?
Software which hides all the many terminal type differences from the user, so the device independent software sees only one type
What are the 3 terminal types we talked about in class?
1. memory mapped interface
2. RS232 Interface
3. Network Interface
What are the 2 types of clocks used?
1. Simple Clocks
2. Programmable Clocks
Simple Clocks
Interrupt on every voltage cycle, Hz = Cycles per second
Programmable Clocks
Use a crystal oscilator (5 to 20 million cycles per second)
Duties of the Clock driver:
1. maintaining time of day
2. Preventing processes from running longer than they are allowed to
3. Accounting for CPU usage
4. Handling the alarm system call made by user processes
5. Providing watchdog timers for parts of the system itself
6. Doing profiling, monitoring, and statistics gathering
Detection and Recovery:
Monitors the requests and releases the resources.
- Often used on large main frame computers, especially batch systems in which killing a process and restarting is acceptable.
Summary of approaches to deadlock prevention:
1. Mutual Exclusion - Spool everything
2. Hold and Wait - Request all resources initially
3. No Preemption - Take resources away
4. Circular Wait - Order resources numerically
- Disk Arm Scheduling -
FCFS
simple but poor performance
SSF
Best performance but with heave requests the disk arm will stay in the middle most of the time
Elevator Alg
Moves in one direction, stops at the last request and moves back to the first request
Block Devices
Make it possible to read or write each block independently of all other ones. (Disks are the most common block devices)
Video RAM
Data buffer that programs or the OS write into