***Background
I understand that everything is added to the stack, when finished, removed from the stack.
What I don't understand is the importance of programming to/around the stack.
Here's how I view the stack:
Linear:
Create int, --> first process in stack.
Add 5 to the int --> second process (becomes first when the creation finishes)
Is that incorrect?
Now, multi-threading:
Begin main --> first process
Begin function2 --> second process
action in main --> third
action in function2 --> fourth
begin function 3 --> fifth
action in main --> sixth
action in function2 --> seventh
action in function3 --> eighth
Is that incorrect?
As things finish they become higher up on the stack?
***What I Need This For
Creating a server-client program. Information is passed from multiple clients to a server. The server then will update ALL the clients with information that is changed from the passed information in one client.
Example:
There are 5 clients, and 1 server.
Client 1 sends an integer of 5.
Client 3 sends an integer of 11.
Server will perform action based on both sent integers, and then send information to Clients 1-5 about the upgrades.
First, I may just be confusing multi-threading with stack. But if each thread contains it's own stack, then I don't understand how information communicates. But I believe I understand multi-threading, therefore the stack. If anyone can confirm - or unconfirmed the way it works, it'd be appreciated.
I do like links, but I have already been doing a lot of exploring into the subject, some do not help -- as it is conceptual only. I do not need examples, I need explanations of what happens, why, and when. (Maybe not so much when, but things to note at least)
Thank you for any help anyone can offer.