Sponsored Content
The Lounge What is on Your Mind? Speculative Shell Feature Brainstorming Post 302514766 by tetsujin on Monday 18th of April 2011 01:48:10 AM
Old 04-18-2011
Quote:
Originally Posted by Corona688
When you make copies of the memory, the memory won't propagate back unless you propagate it yourself. Which opens an even bigger can of worms than just using the originals -- when and if to propagate back.
If it's shared memory you don't make copies. You write to the shared memory and all processes that share that memory see the change. (The same would be true if "subshells" meant to operate on the same environment were threads instead of fork()'ed processes sharing memory - only the sharing mechanism differs.)

If you were saying that the "shell variables" (i.e. the shell's copy of all variables defined in the shell - the working copy shared with all shell processes or threads that are part of the current shell instance) don't propagate back to the "environment variables" (that is, the variables defined in "environ", accessible via C calls to getenv(), etc. in the shell's process) - they don't need to. The only time the shell needs to access its environment variables is at startup, to import those variables into its own working memory. When it runs a command, it forms a new environment including those variables that were exported...

(EDIT): I don't know, maybe I misunderstood you. I guess there is a side to this that I kind of glossed over. Are when you talk about the bigger can of worms, and when to "propagate back" - are you talking about cutting down on the accesses to the shared copy of the shell vars (and related semaphore actions) by pulling things in to a thread-local copy and then writing them back later? I guess that could be a bit of a headache...

Last edited by tetsujin; 04-18-2011 at 03:06 AM..
 

4 More Discussions You Might Find Interesting

1. SCO

BASH-like feature. is possible ?

Greetings... i was wondering if there is any shell configuration or third party application that enables the command history by pressing keyboard up arrow, like GNU/BASH does or are there an SCO compatible bash versio to download? where ? just wondering (sory my stinky english) (2 Replies)
Discussion started by: nEuRoMaNcEr
2 Replies

2. Shell Programming and Scripting

Creating a command history feature in a simple UNIX shell using C

I'm trying to write a history feature to a very simple UNIX shell that will list the last 10 commands used when control-c is pressed. A user can then run a previous command by typing r x, where x is the first letter of the command. I'm having quite a bit of trouble figuring out what I need to do, I... (2 Replies)
Discussion started by: -=Cn=-
2 Replies

3. UNIX for Dummies Questions & Answers

brainstorming automated response

I am managing a database of files for which there is a drop-box and multiple users. what i would like to do is set a criteria for files coming into the drop-box based on file structure. (they must be like this W*/image/W*-1234/0-999.tif) If the files do not match the criteria i want them to be... (1 Reply)
Discussion started by: Movomito
1 Replies

4. UNIX for Beginners Questions & Answers

Can we create any check-point feature in shell ?

I have a script as below and say its failed @ function fs_ck {} then it should exit and next time i execute it it should start from fs_ck {} only Please advise #!/bin/bash logging {} fs_ck {} bkp {} dply {} ## main function### echo Sstarting script echo '####' logging fs_ck... (3 Replies)
Discussion started by: abhaydas
3 Replies
Portable Threads Abstraction Classes(3)                                Coin                                Portable Threads Abstraction Classes(3)

NAME
Portable Threads Abstraction Classes - Classes class SbBarrier The SbBarrier class implements the 'barrier' multi-thread synchronization technique. A barrier is a synchronization mechanism that is used for blocking threads as they enter the barrier until a given number of threads are blocked, at which point all the threads are released again. " class SbCondVar A class for synchronizing access to global variables. Condition variables are used to protect global variables in an environment where multiple threads are running concurrently. " class SbFifo A class for managing a pointer first-in, first-out queue. class SbMutex A basic class for managing a mutex. This class provides a portable framework around the mutex interface of the underlying native thread-handling toolkit. " class SbThreadAutoLock Simple convenience class for locking access to a function. This class provides a simple convenience mechanism for automatically locking access to a function that is not re-entrant. " class SbRWMutex class SbStorage The SbStorage class manages thread-local memory. This class manages thread-local memory. When different threads access the memory an SbStorage object manages, they will receive different memory blocks back. " class SbTypedStorage< Type > The SbTypedStorage class manages generic thread-local memory. This class manages thread-local memory. When different threads access the memory an SbTypedStorage object manages, they will receive different memory blocks back. " class SbThread A class for managing threads. This class provides a portable framework around the tasks of instantiating, starting, stopping and joining threads. " Detailed Description Coin implements a set of abstractions over the native threads data types that can be portably used across all the platforms Coin has been ported to. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 Portable Threads Abstraction Classes(3)
All times are GMT -4. The time now is 08:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy