Skip to content

duong-28/python_exercise_multithreading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

John's Morning Routine Simulation

This project simulates John's morning routine using Python scripts. Each script represents a different version of the routine, showcasing various aspects of concurrency and sequential execution:

  • subtask1.py executes all tasks sequentially.
  • subtask2.py introduces concurrency by allowing John to drink tea and check his phone simultaneously.
  • subtask3.py uses multithreading to simulate concurrent activities during John's breakfast cycle.

Files

Simulates John's normal morning routine sequentially:

  • Eat a sandwich for 8 seconds
  • Drink tea for 3 seconds
  • Eat fruits for 2 seconds
  • Scroll through social media for 10 seconds

Simulates John's new morning routine with some activities happening concurrently:

  • Eat a sandwich for 8 seconds
  • Drink tea for 6 seconds while checking the phone for 2 seconds
  • Eat fruits for 2 seconds
  • Scroll through social media for 7 seconds

Simulates John's breakfast cycle using multithreading to represent concurrent activities. The simulation runs for 3 cycles, with each representing a portion of the breakfast routine:

  • Sandwich bite: 5 seconds
  • Tea sip: 2 seconds
  • Fruit bite: 3 seconds
  • Phone check: 3 seconds

How to Run

To run any of the scripts, use the following command:

python <script_name>.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages