Midterm I Flashcards
What is the onion skin model of an operating system?
Users>Application programs>Operating System>Hardware
What are some functions of operating systems?
– Provides an interface between application programs and the hardware
– Hides the complexity of hardware interfaces from application programs
– Protects the hardware from user mistakes and programming errors (to prevent crashes)
– Manages the hardware resources of the computer systems
– CPU time, disk space, memory access, . . .
– Protects user’s programs and data from each other (security issues)
– Supports inter-process communications and sharing
– Provides resource sharing among users and processes
Who created UNIX?
Ken Thompson 1969
What was MULTICS
A multi-user OS developed by MIT, Bell Labs, and GE for the GE-645 system; a “computing utility”,
similar idea to “cloud”
(a) advanced capabilities, including security mechanisms
– segments instead of files/memory
– dynamic linking, hot-swapping of components
– hierarchical file system, multi-ring security
(b) relied on the special features of the GE-645
(c) was slow and expensive to run
– Ken Thompson wrote a game (Space Travel) which costed $75 dollars to play
(d) The hardware was not up to the demands of the software.
UNIX on PDP
– Ken Thompson, Dennis Ritchie, Rudd Canaday started talking about a system that had 1. a developer friendly environment 2. encouraged “fellowship among users” 3. file system for multiple users 4. was efficient and simple – Implemented it on an old PDP-7, in assembly language 1. Wrote it on a GE system 2. Assembled it 3. Copied it on to paper tape 4. Carried to the PDP-7
When were pipes implemented in UNIX
When UNIX was rewritten in C, pipes were implemented then (1970-73)
Describe the 1980s UNIX wars
1980s Unix Wars
– Many companies (IBM, Bell, Sun, etc) developed their own versions of Unix; Xenix was available for PCs,
being licensed by Microsoft from AT&T
– Ceased to be free, lots of commercialization
– Not a good time for the hobbyist (or academic)
– Different flavours/versions emerged
– System V (AT&T) vs. BSD Unix (UC Berkeley)
– 1985 GNU begins development of a free Unix, except kernel; GNU’s Not UNIX
– 1991 Linus Torvalds develops the Linux kernel
Describe Linux
– 1991: Linus Torvalds announced the project
– Open-source, UNIX-like OS kernel
– Does not share code with UNIX
– Usable in 1992
– Essentially GNU/Linux
– Various distributions available: Fedora, Ubuntu, etc
Explain the concept of a pipeline
A pipe is a mechanism in which the standard output of one process is directed into the standard input of another process. A pipeline is a sequence of several running processes, where each process’s standard output is re-directed into the standard input of the next process. The first process does not have its standard input re-directed, and the last process does not have its standard output re-directed. The processes are executed concurrently
Unifying principles of UNIX (6)
- Everything is either a process or a file
- Pipes are used to connect output of one program to the of the next
- Process spawning and interprocess communication is well-supported, flexible, and cheap
- Communication between programs should be simple
- Cooperating programs don’t know about each other
- Programs are designed “to operate not specifically with each other, but with programs as yet unthought
of” — McIlroy
Notable UNIX features
Allows many users to access a computer system at the same time
– Shares CPU’s, memory, and disk space in a fair and efficient manner among competing processes (CPU time
is split in “slices”, typically 1/10 seconds)
– Processes and peripherals talk to each other even on different machines
– Provides a well-defined set of system calls similar to library routines
– Very portable
Define: File
collection of data (sequence of bytes) stored on disk (or other external storage)
Define: Program
a file containing machine code and data that can be loaded into memory and run
Define Process
Program that is loaded in memory and running
Define kernal
The kernel is the hub of the operating system. It allocates time and memory to programs, handles file storage, and
deals with many other tasks critical to the functioning of a computer. It also handles communications in response
to system calls
Define System Call
A system call is how a program requests a service from the kernel. A system call is usually
implemented as a library function with the same or very similar name. At the machine code level, a system call
usually works by preparing the appropriate parameters in the CPU registers and by making a special jump into the
kernel code
What is the shell
The shell is a text-based interface to the UNIX system. It is a command-line interpreter that interprets user commands
and arranges for their execution. It is usually assumed that a shell is text-based, but GUI (graphical user
interface) window managers act as shells in many ways, and are sometimes also called shells.
– A UNIX characteristic is existance of multiple shells (even Window managers); e.g.:
– Bourne Shell: sh, bash (Bourne-Again Shell); we will focus on this one
– Korn Shell: ksh
– C Shell: csh, tcsh
– Z Shell: zsh
what is a utility
A utility is a program with the same name as its command (example: clear, or date)
what is a command line argument?
– Utilities can accept arguments
– For example, date utility allows us to choose format of the output, as in:
date +%Y-%m-%d-%H-%M-%S
How do you access the manusal
you can access the manual using the “man” command. if you are looking for information on a particular program you can use “man clear” which would give you the manual page about the program clear
what are two important special characters?
Control-C (ˆC) is used to terminate a process
– Control-D (ˆD) is used to signal end of file
what are the standard IO streams for a UNIX program
stdin (standard input)
– stdout (standard output)
– stderr (standard error)
what does the command “cat” do
cat > file.txt will allow creation of a file. cat file.txt will print the contents of file.txt
How to log out of bluenose?
Ctrl-D
What are the 7 types of regular files?
- Regular files
- Directory files
- Buffered special files (block devices)
- Unbuffered special files (character devices)
- Symbolic links
- Pipes (named pipes)
- Sockets
Define: Regular file
Regular files: are files containing text, executable programs, graphics, video, and similar. These are the files
we usually think of by default under the name ‘files’. In a long ls output (ls -l), these files are indicated with
the character ‘-’.
What is a directory file
The directories that store groups of other files are also a type of files called directory files. In a
long ls output, these files are indicated with the character ‘d’.
What are buffered special files
are also called block devices. These files represent disk drives, USB keys and similar
in a direct access. They are called buffered because a buffer in memory is used in reading and writing them. In a
long ls output, these file are indicated with the character ‘b’.
what are unbuffered special files
are also called character devices, and represent devices such as terminal and keyboard.
Both, buffered and unbuffered special files are called device files. In a long ls output, these files are indicated with
the character ‘c’.
what are symbolic links
are references to other files. Using them, we can access existing files through a different
pathname (path). They are similar to shortcuts in Windows. In a long ls output, these files are indicated with the
character ‘l’.
What are pipes
are used for inter-process communication, and they are also called named pipes. This file type should
not be confused with pipes created between processes in a compound shell command. In a long ls output, these
files are indicated with the character ‘p’.
What are sockets
are used for inter-process communication, similarly to pipes. One of the differences is that sockes are
fully duplex-capable; i.e., processes can send data both ways, unlike pipes. Beside data, processes can also send
file descriptors using sockets. In a long ls output, the socket files are indicated with the character ‘s’.
What are pathnames?
Each file has a name
– Files can have the same name if they are in different directories
– Example: see bin in the previous figure
– To distinguish files with the same name, we use pathnames
– Pathname (or path) is a sequence of directories, finishing with a file name
– Directories are separated using character slash (/)
– Example:
/users/faculty/vlado/csci2132/lab1/HelloWorld.java
What is an absolute path
– Absolute path starts from root (initial slash /), examples:
/usr/bin
/users/faculty/vlado/csci2132/lab1/HelloWorld.java
what is a relative path?
Relative path starts from the current directory; examples (if the current directory is ‘vlado’): csci2132 csci2132/lab1/HelloWorld.java ./csci2132/lab1/HelloWorld.java ../../visitor
Parts of a pathname
basename /home/ed/file.txt
basename /home/ed/file.txt .txt
dirname /home/ed/file.txt
path related commands
– ls paths — list directory contents
– pwd — print working directory
– cd path — change directory
– mkdir dirs — make directory(ies)
– mkdir -p paths
– rmdir dirs — remove empty directory(ies)
– mv path1 path2 — move or rename directory or file
– mv -i path1 path2
– rm paths — remove files but can remove directories with option -r; useful to consider -f and -i
what are some file manipulation commands?
– cat files — showing textual file(s) content
– more files — showing textual file content, paged
– head files — showing textual file content, first part
– tail files — showing textual file content, last part
– vi, emacs, pico, nano — file editors
– wc files — word count
What are Usernames and UserIDs
– Used to protect files and processes between different users
– Every user has a unique username, which is a text string
– Try command: whoami
– The system uses numeric userid, which we will call just userID (username is for string id)
– Try command: id -u