Using the Win32 API, write a system program to create a process with a single thread as follows:
a) The process should be used to execute an existing program.
b) After successful running of the process, display the process ID and thread ID.
c) Compile and run the program.
d) Create a zip of the project/program folder and upload.
(a) Fork system call is used for creating a new process, which is called child process, which runs concurrently with the process that makes the fork() call (parent process).
(b) A child process uses the same pc(program counter), same CPU registers, same open files which use in the parent process.
(c) #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
fork();
printf("Hello world!\n");
return 0;
}
Output:
Hello world!
Hello world!
Comments
Leave a comment