The objective of this project is to the creation and execution of threads using the Thread class methods by using java
Budget: $30 – $250 USD
The objective of this project is to the creation and execution of threads using
the Thread class methods. You should use, when necessary, the following methods to synchronize all threads: run(), start(), currentThread(), getName(), join(), yield(), sleep(random time), isAlive(), getPriority(), setPriority(), interrupt(), isInterrupted().
The use of semaphores to synchronize threads is strictly DISALLOWED. Additionally, you are NOT PERMITTED to use any of the following: wait(), notify(), notifyAll(), the synchronized keyword (for methods or blocks), and any synchronized collections or synchronization tools that were not discussed in class or mentioned here.
You CAN, however, use the modifier volatile and the AtomicInteger and AtomicBoolean classes if you choose to.
Directions: Synchronize the applicant, recruiter, technical_interviewer threads in the context of the problem described below. The number of applicants can be entered as a command line argument. Please refer to and read carefully the project notes, tips and guidelines before starting the project.
It’s finally the start of the semester and applications have opened for internships and new grad positions. Due to limited spots, some applicants will either get the job while the rest get rejected.
Applicants apply for the position at different times during the semester (simulated by sleep of random time). Next, they will busy wait for a response.
Once the application is sent to the company, recruiters (assume numRecruiters) begin to look over the applicant’s resume and application. They will consider the applications in the order they were sent. Only one recruiter needs to look over an application (make sure that they pick the next application to be reviewed in a mutual exclusion way). The recruiter might review a few applications a day (sleep of random time for each application reviewed). The recruiter gets to decide whether to let the applicant proceed to the interview phase or if the applicant should be rejected on the spot. Once all the applications are reviewed, the recruiters will send their response letters to the applicants (they will unblock the applicants from the busy waiting state). Assume that 20% of the time, an applicant does not pass the resume phase (generate a number between 0 and 10; if the number is 2 or less then that applicant will be rejected, else they continue on).
The recruiters will terminate after all the applications have been taken into consideration and all the responses have been sent.
Some applicants will move forward onto the interview phase, and the ones who got rejected will terminate. The applicants that will move forward have a list of possible days for the interview. Some applicants are a bit nervous and tend to procrastinate before tackling the technical interview (simulate this by sleep of random time followed by yield() twice), while others (about 30%) are very eager to take the interview (simulate this by increasing their priority. Use getPriority(), setPriority(), and sleep(random time). After the applicant has increased its priority, (s)he will sleep a random time and as soon as (s)he wakes up make sure you reset his/her priority back to the normal value), the rest will let the interviewer know immediately that they are ready. (you might want to use a “ready” arraylist to keep track of the interviews’ order based on the applicant’s readiness). No matter what, after getting ready, all applicants will wait to be called for the interview (simulated by a sleep of long time).
the Thread class methods. You should use, when necessary, the following methods to synchronize all threads: run(), start(), currentThread(), getName(), join(), yield(), sleep(random time), isAlive(), getPriority(), setPriority(), interrupt(), isInterrupted().
The use of semaphores to synchronize threads is strictly DISALLOWED. Additionally, you are NOT PERMITTED to use any of the following: wait(), notify(), notifyAll(), the synchronized keyword (for methods or blocks), and any synchronized collections or synchronization tools that were not discussed in class or mentioned here.
You CAN, however, use the modifier volatile and the AtomicInteger and AtomicBoolean classes if you choose to.
Directions: Synchronize the applicant, recruiter, technical_interviewer threads in the context of the problem described below. The number of applicants can be entered as a command line argument. Please refer to and read carefully the project notes, tips and guidelines before starting the project.
It’s finally the start of the semester and applications have opened for internships and new grad positions. Due to limited spots, some applicants will either get the job while the rest get rejected.
Applicants apply for the position at different times during the semester (simulated by sleep of random time). Next, they will busy wait for a response.
Once the application is sent to the company, recruiters (assume numRecruiters) begin to look over the applicant’s resume and application. They will consider the applications in the order they were sent. Only one recruiter needs to look over an application (make sure that they pick the next application to be reviewed in a mutual exclusion way). The recruiter might review a few applications a day (sleep of random time for each application reviewed). The recruiter gets to decide whether to let the applicant proceed to the interview phase or if the applicant should be rejected on the spot. Once all the applications are reviewed, the recruiters will send their response letters to the applicants (they will unblock the applicants from the busy waiting state). Assume that 20% of the time, an applicant does not pass the resume phase (generate a number between 0 and 10; if the number is 2 or less then that applicant will be rejected, else they continue on).
The recruiters will terminate after all the applications have been taken into consideration and all the responses have been sent.
Some applicants will move forward onto the interview phase, and the ones who got rejected will terminate. The applicants that will move forward have a list of possible days for the interview. Some applicants are a bit nervous and tend to procrastinate before tackling the technical interview (simulate this by sleep of random time followed by yield() twice), while others (about 30%) are very eager to take the interview (simulate this by increasing their priority. Use getPriority(), setPriority(), and sleep(random time). After the applicant has increased its priority, (s)he will sleep a random time and as soon as (s)he wakes up make sure you reset his/her priority back to the normal value), the rest will let the interviewer know immediately that they are ready. (you might want to use a “ready” arraylist to keep track of the interviews’ order based on the applicant’s readiness). No matter what, after getting ready, all applicants will wait to be called for the interview (simulated by a sleep of long time).