Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CS4315 Operating Systems Lab 3: Basic Synchronization using Mutex In this lab work we will do some practice about basic synchronization. Question 1 is about

CS4315 Operating Systems Lab 3: Basic Synchronization using Mutex In this lab work we will do some practice about basic synchronization. Question 1 is about creating threads and each thread runs a different function. Question 2 and 3 are about mutex lock (acquiring a lock and releasing a lock). 1. Run the following C program (tprog1.c) and observe the result on the screen. #include #include #include #include // These two functions will run concurrently void* print_i(void *ptr) { printf("I am in i "); } void* print_j(void *ptr) { printf("I am in j "); } int main() { pthread_t t1,t2; int rc1 = pthread_create(&t1, NULL, print_i, NULL); int rc2 = pthread_create(&t2, NULL, print_j, NULL); exit(0); }

3. Add mutex locks to tprog2.c to achieve synchronization, and then observe the result on your screen.

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

design a simple performance appraisal system

Answered: 1 week ago