Interfaces Flashcards
whats the purpose of OS?
Provide reliable and efficient concurrent execution of multiple
processes
whats the purpose of OS?
Provide mechanisms for inter-process communication to facilitate cooperation between process.
whats the purpose of OS?
Simplify application development by hiding hardware complexity and differences between computer systems behind a clean set of abstractions and corresponding application programming interface(s)
What are sme popularized concepts by UNIX
Unix system calls API
File system as a way of organising system resources
Unix shell language
What is a Process?
An instance of a running program including all system resources
used for that purpose.
How do process interact with each other or the outside world?
Processes interact with each-other and the outside world using only system calls (using ecall instruction). No direct access to MMIO registers is allowed for processes.
what is process “forking” ?
fork() system call creates a copy of the
calling process and assigns it a new PID
* Both the parent and the child processes
continue from the same fork() call, but
– In the parent process, the fork() call returns
the new process PID ≠ 0.
– In the child process fork() returns 0
what does wait(int *status) system call do?
Puts the calling process to sleep until one
of its children processes terminates.
what does exec (prog, arguments) system call do?
Replaces the running program in the calling process
with the program from the file prog.
If the prog file does not exist or cannot be read, exec()
returns an error code, otherwise, exec() never returns
chdir(char *dir) system call
Whats a “relative pathname”?
A path name without the leading “/” is called
relative pathname and it is assumed to
belong in the current working directory.
What is a device driver?
A piece of kernel software that implements device-specific input/output functions is called device driver (e.g. see console.c & uart.c in xv6 /kernel code)
How does “opening” a file work?
open() system call prepares internal OS data
structures for interacting with the file and returns a
reference number (called file descriptor) for the
“opened” file. This reference number is used in all
subsequent system calls.
how does “closing” a file work?
close(fd) “closes” an open file by saving
all outstanding data into the file and
releasing OS data structures allocated for
the file for other uses.
What is a pipe?
Pipe is a communication channel between
two processes.