Skip to content

A multi-threaded program to make sure I'm wearing in my socks evenly

Notifications You must be signed in to change notification settings

Phil-M-H/SocksMultithreading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

SocksMultithreading

I wanted to know if, by pulling my a sock from the front and back of my sock pile, I could ensure that regardless of how I add new socks they would be worn approximately evenly.

A quick program that creates a threadpool and 2 worker objects, a Washer and a Wearer. It then adds tasks to the queue - either pull socks from the pile, and increasing their wear count, or running the washing machine. It will then print out information about how often they've been worn.

Note

Logically, it is obvious that I can treat the pile as a queue and keep it simple. Also that eventually, pulling from both the front and back would wear everything evenly. However, I wanted to know how imbalanced my socks if I did that, and how long before they were evenly worn.

About

A multi-threaded program to make sure I'm wearing in my socks evenly

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages