You are on page 1of 4

UNIX Operating Systems BT0051

SET-1
1. Define Process. Which is the command used to find out currently executing
Process in UNIX?

Ans: A process can be defined as the instance of an executing program. Unix is


multi-tasking operating system. It means at any instant there might be several
programs of several users running in memory. Though there might be several
processes running im memory at any given moment, the CPU can’t cater to only one
of these processes as the other processes await their turn. There is a program called
‘scheduler’ running in memory which decides which process should get the CPU
attention and when. At any given moment a process in memory can be in one of the
six states.

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.

ps command is used to find out currently executing process in UNIX.

2. What is the output of :


$ ps-e
$ ps-a commands

Ans: $ ps-e

PID TTY TIME COMMAND

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

Cybotech Campus Page 1


UNIX Operating Systems BT0051

PID TTY TIME COMMAND

2269 3a 0:05 sh

2396 3a 0:00 ps-a

2100 3b 0:00 sh

2567 3b 0:00 vi

3. Which command is used to transfer a Foreground process to Background?


Give one example.

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 P1 -1 uxmanual &

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&

5. Which command is used to:


Fetch names from a file Name.txt sort them and remove any duplicate entries.

Cybotech Campus Page 2


UNIX Operating Systems BT0051

Ans: $ sort –u Name.txt

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!

Cybotech Campus Page 3


UNIX Operating Systems BT0051

Cybotech Campus Page 4

You might also like