CS notes: storage devices, context switching, and multiprocessors
Secondary storage (Auxiliary Memory Unit)
-
Mainly used to store large amounts of data for a long time
-
When needed, the CPU moves data from secondary storage to main memory and uses it
-
Larger than main memory but much slower, and the stored contents are not lost when the power is off
-
Secondary storage comes in various forms depending on the use
Secondary storage (RAID, SSD)
SSD - Called a zero-spin system because the spinning platter is removed, made of flash memory unlike an HDD, fast load speed with no delay, light and efficient, high durability thanks to shock absorption when dropped or hit, low heat and low noise
RAID - Does not support an error recovery policy. Lets you group several hard disks and use them as one. Advantage of RAID 0: it writes across 2 drives at random and also reads from 2 places, so it is fast. Advantage of RAID 1: even if 1 hard disk fails, the other drive has the same data and can still be used, so data safety can be called high
Role of the system bus
- Connects many registers and I/O devices through one shared path
Types of I/O devices
- Input devices: keyboard, motion sensor, network interface, etc.
- Output devices: monitor, printer, network interface, etc.
- Storage devices: hard disk, CD-ROM, etc.
Context switching
Step 1 (interrupt / system call): the process scheduler in the operating system raises an interrupt
Step 2 (switch to kernel mode): process P0 switches from user mode to kernel mode
Step 3 (save the current process state in the PCB): P0's process information is saved in the PCB
Step 4 (load the next process to run): the state information of the next process, P1, is restored from the PCB
Step 5 (switch to user mode): process P1 switches from kernel mode to user mode and runs
Multiprocessors
- Two or more processors (CPUs) working together to handle one or more tasks at the same time
Pros
-
The independent structure has the advantage of high stability,
-
Even if one of the processes has a problem, it doesn't affect the others. You may lose some speed, but problems like the whole thing stopping don't happen
-
When several processes need to be handled and they use the same data, keeping that data on one disk and having all processors share it costs less
Cons
-
Because the memory areas are separate, the more work there is, the more overhead it causes, which can lower performance
-
Context switching involves heavy work such as resetting cache memory and takes time, which adds overhead
- #CS fundamentals