Hello all.
I am trying to replicate what is happening on this page under the tcsh shell, but using the bash shell found in Wheezy.
Here is the page I am referring to: http://pages.cs.wisc.edu/~remzi/OSTEP/intro.pdf
The command I am trying to replicate is on page 6 under figure 2.4.
The command is "prompt> ./mem &; ./mem &".
I would like to run the same program twice, concurrently, but do not know how. Note that I am not trying to use a bash script, but rather by simply using syntax on the command line.
Any help (and possibly an explanation) would be greatly appreciated!
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Running programs in parallel in Bash
Re: Running programs in parallel in Bash
Try it without the semicolons.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan
-
- Posts: 4
- Joined: 2014-05-20 14:33
Re: Running programs in parallel in Bash
Thank you, worked great.
Although I am not getting the same results as in book is getting, i.e. the pointer has a different address for each instance whereas the book's pointer has the same address. Can you explain why that is?
Although I am not getting the same results as in book is getting, i.e. the pointer has a different address for each instance whereas the book's pointer has the same address. Can you explain why that is?
Re: Running programs in parallel in Bash
Without researching it too deeply, I would guess the addresses are different because the author was using Solaris or BSD, whereas you're running a Linux system. Linux introduces a random offset to the process's stack and heap locations. This is done to mitigate the problem of nefarious processes employing stack overflow or array bounds exploits to access memory locations that they shouldn't (i.e., memory locations are made intentionally unpredictable from one instance of a process to another).walking_stick wrote:Although I am not getting the same results as in book is getting, i.e. the pointer has a different address for each instance whereas the book's pointer has the same address. Can you explain why that is?
This is just a guess. Please correct me if you find out differently.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian Kernighan
-
- Posts: 4
- Joined: 2014-05-20 14:33
Re: Running programs in parallel in Bash
Ahhh so you're thinking it could be due to ASLR? I was thinking about that at work today. Seems pretty plausible to me.
I will post if I find out something different.
EDIT: Haha so at the footnote at the end of the page, they mention that the results will match only if address space randomization is turned off. I guess that settles that; you got it right!
I will post if I find out something different.
EDIT: Haha so at the footnote at the end of the page, they mention that the results will match only if address space randomization is turned off. I guess that settles that; you got it right!