For further actions, you may consider blocking this person and/or reporting abuse
Read next
Performing Backups in Linux: Tools and the 3-2-1 Strategy
ispmanager.com -
Get Ready for Black Friday 2024: Share Your Wishlist! ๐๏ธ
Vinish Bhaskar -
Introducing Dev Volunteer, Join Us in Improving the DEV Community
Shafayet Hossain -
Serenity, feasibility, priority: putting emotion-driven development into practice
Ingo Steinke, web developer -
Top comments (4)
A process is like a big barn: It takes a long time to build, and it has big, sturdy walls to keep others out. It has places to store things like food for horses. Inside the barn, horses are safe to run and play. The barn knows about all the horses, food, training schedules for the horses, and stuff like that.
A barn's a happening place, I tell you!
A thread is like a single horse running around inside that barn. The horse is kind of silly; it only knows where it is right now and it can retrace its steps. It can eat the grain from the barn along with the other horses in the pasture. Sometimes, it steps on the other horses, and they fight with one another. Sometimes they eat each others grain, and they go hungry. Sometimes they just run around crazy until someone from the farm trains them.
I'm sure someone will explain this far better than I'll ever can. So I'll go for the shortest way I can put this :)
I think you can look at things like this:
What's the main difference - threads can share memory and data, and be able to work on the same memory set, while processes are isolated.
You are 5y old now, until you are 18 you are dependent and attached to your mother, she protects you from outside world, she delivers you the filtered messages and most important she decided what are your house chores.
You share the same house / environment and have access to the same rooms / books from the shelves and utilities (water, power etc).
Your mother consumes more resources than you and it's bigger of course. A mother can have multiple children, that consume fewer resources.
Mother - process
Kid - thread
House - RAM (is shared)
House chores - the data to execute / instructions
You can use threads directly example in Java/C++, but other languages have a smaller kind of threads. Example GO has goroutines, and the runtime can pack thousands of goroutines in a managed thread. From the programmer point of view there is no difference.