Professional Documents
Culture Documents
SET-1
1. Define Process. Which is the command used to find out currently executing
Process in UNIX?
When you execute a program the scheduler submits your process to a queue called
process queue. At this instant the process is said to be in submit state. Once
submitted the process waits its turn in the queue for some time. At this stage the
process is said to be in hold state. As the process advances in the queue at some
instant it would become the next one in the queue to receive CPU attention. At this
stage it is in ready state. Finally the process gets the attention of the CPU and starts
getting executed and thereby attains the run state.
Ans: $ ps-e
0 ? 0:00 sched
1 ? 0:01 init
2 ? 0:00 vhand
3 ? 0:00 bdflush
487 01 0:01 sh
288 02 0:01 sh
$ ps-a
2269 3a 0:05 sh
2100 3b 0:00 sh
2567 3b 0:00 vi
Ans: Ampersand (&) symbol is provided by the UNIX to run the process in the
background. While executing the command, if this symbol is placed at the end of the
command then the command will be executed in the background. When we run a
process in the background a number is displayed on the screen. This is the PID of
the process that we have just executed in thye background.
As for example
$ sort student.dat>std.out $
16894
$
4. Say you have three Process P1, P2 and P3 running in background. You want
to assign priorities to them, which command is suitable give its syntax?
Ans: In the UNIX systems process are usually executed with equal priority. This is
not always desirable since high-priority jobs must be completed at the earliest. UNIX
offera the nice command, which IS Used with the operator to reduce the priority of
jobs.
To run a process with a low priority, the command name should be prefixed with
nice:
Nice value range from 0 to 39, and commands run with a nice value of 20 in the
Bourne shell, a higher nice value meaning a lower prioritoy. nice reduces theb
priority of any process by 10 units, raising its nice value to 30. The amount of
reduction can also be specified with the –n option:
Nice –n 15 wc -1 uxmanual&
6. Which commands are used to carry out following operations in vi- Editor:
To save a file
To start editing a file
To save and Quit a file
To quit without saving (Forced quit)
Ans: 1 :wfilename
2 :i
3: wq
4: q!