Tekstmanipulatie, week 15


More about Unix: processes ('ps', 'kill', &), compression ('tar'), 'find', timing ('at'), variables ('set')


Most of the commands that we have learnt are actually executable (most often, binary) files. You can locate those files in the directory system by using the command "which" (for instance, "which cp" will return something like: /bin/cp; "which grep" may return: /usr/bin/grep). If you don't give the full path (absolute or relative path) of a program to be executed (let it be a standard Unix command or an executable file that you have created yourself), then the shell uses the variable "PATH", and checks the directories specified therein. You can read the value of this variable, either by typing echo $PATH, or by typing set | grep PATH .

It is a key idea of Unix to run more processes in the same time. Each user will run his or her processes. For each user, at least a shell is running. Furthermore, even one user can run more processes in the same time, and this is indeed the case almost always. The system also runs processes by its own.

A process can launch a child process. This is the case for instance when you run a command or a program in shell: then shell launches a child process. If the command line ends with the & symbol, then you get back the prompt immediately. Otherwise, shell waits for its child process to terminate.

The key idea for having multiple processes in the same time is time sharring. The CPU time is divided into small time slots, and each process is assigned some time slots. Because these time slots are very small, the human user has the filling that the CPU deals exclusively with him or her.

The command "time" is usefull when you want to check how much time the CPU really needs to execute a command line. If you measured the time on your own watch, you would also measured the time needed to execute all kinds of other processes running in the same time.

The command 'at' can be used, if you don't want to run a process immediately, but at some moment in the future (for instance, in the night, when the computer is less used by other processes).

What to do if you want to kill a process (e.g.: your program has run into an infinite loop; an application is frosen down;...)?



More shell scripts: conditions, cycles


Please read this text.

Also look at the sample files that I used in the lecture: they are available on Hagen (the machines in the computer lab), under: /users1/birot/Examples-week14/ . Read them, try them out, play with them (modify them and look at the result): try to really understand them, in all their details.


Please, contact me, if you have any doubt.





Bíró Tamás:
e-mail
English web site
Magyar honlap

Last modified: Thu Jul 3 11:39:17 METDST 2003