cmpsc311 Systems Programming
cmpsc311 Systems Programming
Systems Programming
Module: Systems Programming
Java
C application C++ application
application
provides
service to client client client
layers above
your system
understands
layer below
and relies on
layers below layer below
•••
more useful,
portable, reliable client client client
abstractions
your system
constrained
by performance, layer below
footprint, behavior
of the layers below layer below
•••
Tip: if you want to see what processes are running on your UNIX system,
use the “ps” command, e.g., “ps -ax”.
CMPSC 311 - Introduction to Systems Programming
Page
16
Files
• A file is an abstraction of a read only, write only, or
ready/write data object.
‣ A data file is a collection of data on some media
• often on secondary storage (hard disk)
‣ Files can be much more: in UNIX nearly everything is a file
• Devices like printers, USB buses, disks, etc.
• System services like sources of randomness (RNG)
• Terminal (user input/out devices)
Tip: /dev directory of UNIX contains real and virtual devices, e.g., “ls /dev”.
CMPSC 311 - Introduction to Systems Programming
Page
17
Virtual Memory
• The virtual memory abstraction
provides control over an imaginary
address space
‣ Has a virtual address space which
is unique to the process
‣ The OS/hardware work together to map
the address on to ...
• Physical memory addresses
• Addresses on disk (swap space)
‣ Advantages
• Avoids interference from other processes
• swap allows more memory use than physically
available
•••
• Programs Refer to Virtual Addresses
‣ Conceptually very large array of bytes
‣ Actually implemented with hierarchy of different memory types
‣ System provides address space private to particular “process”
• Program being executed
• Program can clobber its own data, but not that of others