The UNIX Operating System

Also: libraries which provide a higher-level view/API than do the system calls. (API = application programming interface)

Overview of UNIX portion of course

We'll (try to) cover:

Basics: Files and Processes

Directories, pathnames


Example:

	/users/faculty/eileen/intro.notes  (absolute pathname)

	if _current working directory_ is /users/faculty/eileen,

	then can use 

		intro.notes	(relative pathname)

	if _current working directory_ is /users/faculty

	then can use

		eileen/intro.notes (also a relative pathname)

Ownership, permissions

Devices

UNIX treats devices like files. That is, a filname exists that represents a device like a keyboard or printer. To write to the printer, you can just write to the file that represents it...
	for example:

		cat fileX > /dev/rmt0

causes the conents of fileX to be written to the tape drive associated with the rmt0 file in the /dev directory

Processes

process = instance of an executing program

When you type:


> ls

at the command line, the shell process creates a process to run ls. UNIX is multitasking -- more than one process can run at the same time. (multiple processes share the CPU)

IPC - Interprocess communication

mechanisms that allow processes to send each other info. Methods differ in type/amount of info, number of processes, whether processes need to exist at the same time, be on same machine, etc.

pipes - output of one program is input of another

shell supports this:


	> ls | more
	
	output of the ls program is input to the more program


	> ls | grep notes | more

	output of the ls program is input to the grep program
	notes is a command line parameter to grep
	output of grep is input to more

signals
processes that exist at same time on same machine can send integer signals
shared memory
processes that exist at same time can share variables
semaphores
to control access to shared memory
sockets
processes that exist at same time on same or different machines can communicate arbitrary info

System calls and library functions

In this course, you'll learn about the "system call interface"
kernel
memory resident program, deals with process scheduling and i/o control
system calls
the interface to the kernel and the resources it controls. Are invoked like library subroutines (but typically more efficient, lower level, run in 'kernel mode' rather than 'user mode'). Library routines are a layer between user code and system calls. Example:

library call:

	nread = fread(inputbuf, OBJSIZE, numerobjs, fileptr);

system call:

	nread = read(filedes, inputbuf, BUFSIZE)