Home » Resources » Linux » Unix 101
Unix 101 (02)

'Unix is not so much an operating system as a way of thinking.' - Old Computer Science Proverb
fork
One of Ken Thompson's cornerstone concepts was that processes be unable to communicate with one another save to know of each other's existence. Classic Unix has no inter-process communication whatsoever. When one process - such as the user's login - wishes to create another process, something called fork starts to happen.
The 'fork' is as a fork in the road, so to speak. The process wishing to create a new process - e.g. you want to start the ls command - first creates a copy of itself, and then this copy morphs into the command you issued. Your initial process will then wait and hang on the completion of the 'child' process. While Microsoft Windows does not officially admit of a family hierarchy between processes, classic Unix - as well as MS-DOS to a great extent - does.
ps
ps is the process status command. Just as ls, it will admit of a plethora of command line switches which will vary from system to system.
With classic Unix it is possible to trace one's own login all the way back to process 0 or the process table, and every process has a number, or process ID. ps will list the process IDs for the parent processes as well.
kill
kill is the command used to kill processes - with varying amounts of prejudice. kill -9 is traditionally the meanest kind of kill available. A cute trick is to find your own login process number in the ps table and then kill it (can you guess what happens?).
login
As all processes hang and wait on other processes, so does the process that processed your login. It simply waits until you decide to log out again. Your logging out is the termination of the process which the login created for you after you validated your ID and password.
When login notices that this process has exited, it continues execution itself - looping around and displaying a new login screen.
telnet
telnet can be used to log in to remote systems. Provided you have superuser rights on these remote systems, you have the ability to kill any processes running on them - including other user logins. A quick look at the ps process table will tell you immediately who is logged in.
nice
nice is the command for creating processes with a priority other than the default. Priorities are from 20 to -20, with -20 being the highest. Normally processes are created at priority 0 - right in the middle. If you want a process to use very little CPU time, you give it a positive priority; if you want it to use lots of CPU time, you give it a negative priority.
Next »
|