You are on page 1of 3

Umer Waseem

Section B
Bcs02153308

Q1:Write a simple “Hello World” program in C and compile it under Linux


(any flavor) using gcc compiler.
Ans: gedit use for create file any type of extension I have create code1.c
file create and then write the code in that particular file. gcc is Compiler for
Linux. –o is mode of gcc compiler. In that Problem only print Hello World.
That program in c basic.

Q2: Run and see the output of the fork() program (Nag.c) discussed in the
class.
Ans: gedit use for create file any type of extension I have create code2.c
file create and then write the code in that particular file. gcc is Compiler for
Linux. –o is mode of gcc compiler.
In That Program Fork system call use for creates a new process, which is
called child process, which runs concurrently with process (which process
called system call fork) and this process is called parent process. After a
new child process created, both processes will execute the next instruction
following the fork() system call. A child process use same pc(program
counter), same CPU registers, same open files which use in parent
process.

Q3: Run and see the output of the exec() program (HungryEyes.c)
discussed in the class.
Ans: exec is used when the user wants to launch a new file or program in
the same process. The exec system call is used to execute a file which is
residing in an active process. When exec is called the previous executable
file is replaced and new file is executed.
More precisely, we can say that using exec system call will replace the old
file or program from the process with a new file or program. The entire
content of the process is replaced with a new program.
In That Program Use xeyes File for Eyes View Show.

You might also like