Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hello can you help asap 4. Short-answer Questions (25) 1.(5) Describe the relationship between user threads and kernel threads. 2.(5) What is deadlock? List the

image text in transcribed
hello can you help asap
4. Short-answer Questions (25) 1.(5) Describe the relationship between user threads and kernel threads. 2.(5) What is deadlock? List the four conditions which will lead to a deadlock. 3.(5) Describe the definition of race condition. Show in detail an example in which race condition happens. 4. (5) What is critical section? How to solve the critical section problem? 5. Read the code "test.c" below and answer questions. 1) Write the command to compile this code thus to generate an executable file named temp. 2) Show the results of running this code and explain the reason behind. int main(void) { pid_t pid; int count=0; count=count + 1; pid=fork(); if(pid=0){ count = count +5; printf("part 1: count=%d ", count); execlp("/bin/ls", "Is", NULL); printf("part 1, pid is %d ", getpid()); } else if(pid>0){ count = count +7; printf("part 2: count=%d ",count); execlp("/bin/cp", "cp", "test.c", "myfile", NULL); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions