Вы находитесь на странице: 1из 2

AIM:

To Execute a Unix Command in a C program using getpid() system call.


ALGORITHM:
1. Start the program
2. Declare the necessary variables
3. The getppid() system call returns the process ID of the parent of the
calling process and getpid() to return the process id.
5. Stop the program.

Open:
AIM:
To Execute a Unix Command in a C program using open() system call.
ALGORITHM:
1. Start the program
2. Declare the necessary variables
3. Open file1.dat to read or write access
4. Create file1.dat if it doesnt exist
5. otherwise Return error if file already exist.

Read:
AIM:
To Execute a Unix Command in a C program using read() system call.
ALGORITHM:
1. Start the program
2. Declare the necessary variables
3. Permit read access to the given file name testfile1.txt
4. print the read content on your terminal.

5.close file descriptor.

Write:
AIM:
To Execute a Unix Command in a C program using write() system call.
ALGORITHM:
1. Start the program
2. Declare the necessary variables
3. Permit write access to the given file name
4. Write the content into defined file.

5.close file descriptor.


Fork():

AIM:
To create a child process using Fork() system call.

ALGORITHM:
1. Declare the necessary variables.
2. Parent process is the process of the program which is running.
3. Create the child1 process using fork() When parent is active.

4.Print the parent process and child process using for loop.

5.Terminate the program.

Write result for unix commands .I already gave aim,explanation for


each command in printout itself.

Вам также может понравиться