Oneill
Oneill

Reputation: 339

Shared memory in C with LinkedList

I have to develop a mini-shell in C. In this project we have to deal with local variables and environment variables. So we can have two process that shared environment variables, a variable create in the child can be seen in the father and inversely.

My teacher says: The environment variables are stored in a shared memory area that is created by the first copy of your shell that runs and is initialized with all the variables defined in the envp array. The last copy of your shell that runs at any given time must destroy that space. This shared memory area is to be managed as a memory by subdivision. The shared memory area is a concurrent access memory area with multiple possible simultaneous reads but only 1 write possible at a given time. Implementation must give priority to writing.

So we need shared memory with linked list who contains:

But when we create a environment variable in the father there is not in the child.

So I think this method is not correct, how can we represents this problem ?

Maybe not use a linked list ?

Thank you.

TF.

Upvotes: 1

Views: 417

Answers (1)

Oneill
Oneill

Reputation: 339

I understand ! My teacher say me to create a shared memory space with fixed size ! It's simple now.

Thank you everyone.

Upvotes: 1

Related Questions