Interfaces Flashcards

1
Q

whats the purpose of OS?

A

Provide reliable and efficient concurrent execution of multiple
processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

whats the purpose of OS?

A

Provide mechanisms for inter-process communication to facilitate cooperation between process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

whats the purpose of OS?

A

Simplify application development by hiding hardware complexity and differences between computer systems behind a clean set of abstractions and corresponding application programming interface(s)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are sme popularized concepts by UNIX

A

Unix system calls API
File system as a way of organising system resources
Unix shell language

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a Process?

A

An instance of a running program including all system resources
used for that purpose.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do process interact with each other or the outside world?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is process “forking” ?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does wait(int *status) system call do?

A

Puts the calling process to sleep until one
of its children processes terminates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what does exec (prog, arguments) system call do?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

chdir(char *dir) system call

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Whats a “relative pathname”?

A

A path name without the leading “/” is called
relative pathname and it is assumed to
belong in the current working directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a device driver?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does “opening” a file work?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

how does “closing” a file work?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a pipe?

A

Pipe is a communication channel between
two processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are “shell scripts” ?

A

– when takes commands from a file
– such files are called shell scripts

17
Q

Dual role of UNIX SHELL

A

Interactive user interface
– Consumes commands typed by the user,
starts new processes that run executable files
* Programming language
– when takes commands from a file
– such files are called shell scripts

18
Q

what is bash?

A

is a type of unix shell called; “Bourne-Again Shell” - default shell in Ubuntu, backwards compatible
with the original Unix shell

19
Q

form of bash command line?

A

Bash command # comment

20
Q

A simple command syntax

A

command arg1 arg2 … argN
* Elements of the command are separated from
each other by blanks

21
Q

what do this “pwd” command mean?

A

print the full name of the working
directory

22
Q

what do this “cd” command mean?

A

change working directory to your
home directory

23
Q

what do this “cd ..” command mean?

A

change working directory by going one
level up in the directory tree

24
Q

what do this “cd directory” command mean?

A

change working directory to the
directory with the specified pathname
(directory)

25
Q

what do this “./program” command mean?

A

Run the executable file program from
the working directory

26
Q

what do this “pico” command mean?

A

Start a text editor

27
Q

what do this “cat file” command mean?

A

display the contents of the file with
the name file

28
Q

what do this “co foo bar” command mean?

A

copy the contents of the file with the
name foo into the file with the name bar
(create new file bar if it does not exist)

29
Q

what do this “mv foo bar” command mean?

A

move the file foo into bar

30
Q

what do this “ln foo bar” command mean?

A

create a link bar to the file foo

31
Q

what do this “rm foo” command mean?

A

delete (remove) file named foo

32
Q

what do this “mkdir dirname” command mean?

A

Create (make) directory with the name
dirname

33
Q

what do this “rmkdir dirname” command mean?

A

Delete (remove) directory with the name
dirname

34
Q

what do this “man command” command mean?

A

Displays manual page for the command
command

35
Q

what do this “apropos keywords” command mean?

A

Lists commands whose brief description
contains keywords

36
Q

What is the unix “Philosophy” ?

A

Write programs that do one thing and do it well
Write programs to work together
Write programs to handle text streams, because that is a universal interface

37
Q
A