Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started