Question: NEED ACTUAL CODE! Facing the kindergarten synchronization problem (Kindergarten), where regulations require that one teacher per R children is always present, where R is an
NEED ACTUAL CODE!
Facing the kindergarten synchronization problem ("Kindergarten"), where regulations require that one teacher per R children is always present, where R is an integer (e.g., child / teacher ratio 3: 1) to ensure proper supervision of children. Moreover, we would wish for our configuration to have the following characteristics: 1. If a teacher attempts to leave but this is not possible, he should returns in office (and not block while waiting for the exit condition to be met). 2. Every parent should be able to enter the nursery area to verify whether the regulation is met. Please provide the synchronized processes: Teacher, Children, Parents, which satisfy the requirements above, by further defining functions: _enter (), _exit () and verify_compliance () that are subsequently used, or replace them (their call) with the appropriate code within: Teachers, Children and Parents. You may use mutexes/ locks, semaphores, shared variables). void Teacher() { for (;;) { teacher_enter(); ...critical section... teach(); teacher_exit(); go_home(); } } void Child() { for(;;){ child_enter(); ...critical section... learn(); child_exist(); go_home(); } } void Parent() { for(;;){ parent_enter(); ...critical section... verify_compliance(); parent_exit(); go_home(); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
