Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#de fine MAX PROCESSES 255 int number of processes 0 /* the implementation of fork () calls this function */ int allocate process () int

image text in transcribed
#de fine MAX PROCESSES 255 int number of processes 0 /* the implementation of fork () calls this function */ int allocate process () int new pid; if (number of processesMAX PROCESSES) return -1; else / allocate necessary process resources */ ++number of processes; return new pid; / the implementation of exit) calls this function / void release process () / release process resources / --number of processes a. Identify the race condition(s). b. Assume you have a mutex lock named mutex with the operations acquire() and release(). Indicate where the locking needs to be placed to prevent the race condition(s) c. Could we replace the integer variable "int number of processes o" with the atomic integer "atomic_t number of processes - o" to prevent the race condition(s)

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

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

ISBN: 978-0764535376

More Books

Students also viewed these Databases questions