Beruflich Dokumente
Kultur Dokumente
Files and
program’s memory(i.e. variables, malloced memory,
etc.)
How files get managed?
● What we see is a logical abstraction as a tree
● Is that how files are stored?
● Files are stored on hard drive
● Every file is essentially some bit sequence (or byte sequence) stored on
the hard drive
● The hard drive is a mechanical device, using magnetic physics to store
data
● A software called Disk device driver knows how to store data on
the hard drive
● In general, user programs (like yours) are not permitted to access
any hardware (mouse, keyboard, memory, disk, etc.)
● Do you know any C language feature which allows you to access them?
System Calls
● The only way a user program can interact with a
hardware device is by requesting the OS to do the
desired task
● The OS provides functions for this
● These functions are called “System Calls”
● Your C library has wrapper functions for these system
calls
– E.g. printf() ! --> It accesses the screen!
●
Layered Design
int main() {
int x, y, z; User programs/
scanf(“%d%d”, &x, &y); application/
z = x + y; libraries
User Program
printf(“%d\n”, z);
return 0;
}