Programming Question

DescriptionInstructions
Complete the following learning activities for Assignment 3. Use
the script command to save the terminal session wherever necessary. Saving
the terminal starts with the script filename command and ends with exit.
Combine your answers into one file and name it COMP325_3_YYMM (replacing
YYMM with the current year and month; e.g., 2203). Submit your assignment to
your Academic Expert for marking and feedback using this Assignment Drop
Box.
Be sure to complete the final step—click the Submit assignment button—to
notify your Academic Expert.
1. (10 marks) Create a zombie process on your UNIX system. Use the ps command to show
the process and its state.
2. (5 marks) Create a process using the following command: sleep 1000 &
Now use the kill, ps, grep, and awk commands in a pipe to find this process and terminate
it.
3. (5 marks) Explain how it would be possible to write a program, for example in C, that will
not terminate when Ctrl+C is pressed. Provide a detailed explanation about the signals and
the associated signal handling.
4. (5 marks) Describe the difference between the following two commands:
ln filename1 filename2
ln -s filename1 filename2
5. (5 marks) What will happen if you delete a hard link? Are there circumstances under which
deleting the hard link will result in the removal of the file itself?
6. (5 marks) Explain how the dmesg command can be used to find the kernel version of your
UNIX machine. Write a command that will output the exact kernel version only.
7. (8 marks) Explain what each statement means.
a. if (pipe(pipefd) == -1)
b. while ((nbytes = read(pipe, inbuf, MSGSIZE)) > 0)
c. if (pipe2(p, O_NONBLOCK | O_CLOEXEC))
d. if((childpid = fork()) == -1)
8. (16 marks) Write a program that takes one command line argument: the fully qualified
name of a folder. The program creates two children processes. The first child process
checks whether the input folder name already exists on the filesystem and communicates
the outcome to the second child process via a pipe and exits. The second child process will
then either create the folder if it does not exist or perform no action if the folder already
exists. Upon creation of the folder, the second child process sends a confirmation message
to the parent process via another pipe and then exits. The parent process then checks for
the folder to be empty. If there is content in this folder, the parent process deletes all
content and prints a message for the user upon successful completion and terminates. All
printing, input, and reading (from filesystem or the console) should be done by system calls.
You cannot use any library functions.
9. (6 marks) Suppose S is a connection-oriented concurrent server.
a. If S is currently serving K clients, how many sockets and slave processes is the
server using? Explain.
b. What would these numbers be if S were a connectionless concurrent server?
Explain.
10. (15 marks) Explain what each command does.
a. ss -s
b. ss -l
c. ss -w -a
d. ss -4 state syn-sent
e. time ss -atr
11. (20 marks) Implement a solution using the C programming language for the dining
philosophers problem. Read the Dining Philosophers Problem for a complete description.
Each philosopher, and fork, needs to be implemented as a separate process that
communicates with each other through TCP/IP.
Make sure to submit the code for this program along with sufficient documentation to
explain your thought process. The main objective of the program will be to show your
command of process communication through TCP/IP; therefore, marks will not be deducted
if your solution does, in fact, lead to starvation.

Purchase answer to see full
attachment

DescriptionInstructions
Complete the following learning activities for Assignment 3. Use
the script command to save the terminal session wherever necessary. Saving
the terminal starts with the script filename command and ends with exit.
Combine your answers into one file and name it COMP325_3_YYMM (replacing
YYMM with the current year and month; e.g., 2203). Submit your assignment to
your Academic Expert for marking and feedback using this Assignment Drop
Box.
Be sure to complete the final step—click the Submit assignment button—to
notify your Academic Expert.
1. (10 marks) Create a zombie process on your UNIX system. Use the ps command to show
the process and its state.
2. (5 marks) Create a process using the following command: sleep 1000 &
Now use the kill, ps, grep, and awk commands in a pipe to find this process and terminate
it.
3. (5 marks) Explain how it would be possible to write a program, for example in C, that will
not terminate when Ctrl+C is pressed. Provide a detailed explanation about the signals and
the associated signal handling.
4. (5 marks) Describe the difference between the following two commands:
ln filename1 filename2
ln -s filename1 filename2
5. (5 marks) What will happen if you delete a hard link? Are there circumstances under which
deleting the hard link will result in the removal of the file itself?
6. (5 marks) Explain how the dmesg command can be used to find the kernel version of your
UNIX machine. Write a command that will output the exact kernel version only.
7. (8 marks) Explain what each statement means.
a. if (pipe(pipefd) == -1)
b. while ((nbytes = read(pipe, inbuf, MSGSIZE)) > 0)
c. if (pipe2(p, O_NONBLOCK | O_CLOEXEC))
d. if((childpid = fork()) == -1)
8. (16 marks) Write a program that takes one command line argument: the fully qualified
name of a folder. The program creates two children processes. The first child process
checks whether the input folder name already exists on the filesystem and communicates
the outcome to the second child process via a pipe and exits. The second child process will
then either create the folder if it does not exist or perform no action if the folder already
exists. Upon creation of the folder, the second child process sends a confirmation message
to the parent process via another pipe and then exits. The parent process then checks for
the folder to be empty. If there is content in this folder, the parent process deletes all
content and prints a message for the user upon successful completion and terminates. All
printing, input, and reading (from filesystem or the console) should be done by system calls.
You cannot use any library functions.
9. (6 marks) Suppose S is a connection-oriented concurrent server.
a. If S is currently serving K clients, how many sockets and slave processes is the
server using? Explain.
b. What would these numbers be if S were a connectionless concurrent server?
Explain.
10. (15 marks) Explain what each command does.
a. ss -s
b. ss -l
c. ss -w -a
d. ss -4 state syn-sent
e. time ss -atr
11. (20 marks) Implement a solution using the C programming language for the dining
philosophers problem. Read the Dining Philosophers Problem for a complete description.
Each philosopher, and fork, needs to be implemented as a separate process that
communicates with each other through TCP/IP.
Make sure to submit the code for this program along with sufficient documentation to
explain your thought process. The main objective of the program will be to show your
command of process communication through TCP/IP; therefore, marks will not be deducted
if your solution does, in fact, lead to starvation.
Purchase answer to see full
 attachment

Why Choose Us

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee

How it Works

  • Click on the “Place Your Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the "PAPER DETAILS" section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.