Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finished ex1 #390

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vscode/ipch/102df1d42b7a3ca4/mmap_address.bin
Binary file not shown.
Binary file added ex1/a.out
Binary file not shown.
17 changes: 16 additions & 1 deletion ex1/ex1.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@

int main(void)
{
// Your code here
int x=100;
printf("Main process id is: %d, value of x is: %d", (int)getpid(), x);
int rc= fork();
if (rc < 0)
{
printf("Forking failed \n");
}
else if (rc == 0)
{
printf("Main process id is: %d, value of x is: %d", (int)getpid(), x);
}
else
{
int x = 200;
printf("Main process id is: %d, value of x is: %d", (int)getpid(), x);

}
return 0;
}
Binary file added ex1/main
Binary file not shown.