Week Eight - Devices
Contents
Devices
In Unix, devices can be accessed via a filepath!
Have a try and look at ls /dev
!
Though we cannot directly access the contents by just reading the contents of the (or can you), this convention allows programs to be function more synonymously as a ‘file’.
Unix Devices
/dev/diskN
- Hard disk partition/dev/ttyN
- Terminal device/dev/ptyN
- Pseudo-terminal device
/dev/mem
- Physical memory (RO)/dev/null
- Data sink/dev/random
- Pesudo-random number stream
Special Devices
Character Devices
- Unbuffered direct access to hardware device
- Read and write by bytes
Block Devices
- Buffered access to hardware device
- Read and write by chunks of bytes at a time