0

How is the seperation of multiple instances of the same project/program done, that means which mechanism seperates the data of two instances of the same project/program?

Edit: Examples:

  1. When using a write program two times and working with FILE1 and FILE2. How do most OS seperate the two instances? As I have read in the comments the files get different memory blocks. Do the memory blocks "get" the name of the files, like block143 can be adressed by FILE1 and block223 can be addressed by FILE2?
  2. Simulation: If I call one simulation type (same commandline arguments) on two different data input files. How does the OS seperate those files concerning the addressing of the different memory blocks/instances?

greetings streight

Streight
  • 811
  • 4
  • 15
  • 28
  • 10
    The Operating System. – user123 Dec 02 '13 at 15:12
  • 4
    Expanding on that, the OS assigns each program or an instance of a program a certain block of memory. Have you ever tried accessing random memory? Most of the time your program would crash. This is due to OS handling. If you access memory not assigned to you, the OS automatically crashes your program (security feature) – Rahul Shardha Dec 02 '13 at 15:13
  • So it is like: instance one -> you got memory block 145 and instance 2 -> you got memory block 186 ? So the instances are "caged" inside memory block? – Streight Dec 02 '13 at 15:16
  • Do you know how memory is divided? There is a separate memory for the `program` and the memory that the `program uses`. The memory given to the program to run (space required by the class/function name etc... ) is separate from any variable you would assign during runtime. Not the perfect way to put it but glossing it over, you can say yes, the memory is caged inside a block – Rahul Shardha Dec 02 '13 at 15:19
  • 2
    All of the above is of course assuming that your OS _does_ support multiple processes executing in parallel - very old or very limited embedded systems may not even support this at all. – Hulk Dec 02 '13 at 15:21
  • 1
    I suggest editing your question to ask a specific question. The question you've described is too broad and doesn't really depict a problem. @Hulk, excellent point to remember if your dwelling into memory spaces. A lot of boards you work on (in school) do not support something like this and you have to write it on your own. – Rahul Shardha Dec 02 '13 at 15:21

1 Answers1

1

An answer from the discussion above :

The OS assigns each program or an instance of a program a certain block of memory. Have you ever tried accessing random memory? Most of the time your program would crash. This is due to OS handling. If you access memory not assigned to you, the OS automatically crashes your program (security feature).

There is a separate memory for the program and the memory that the program uses. The memory given to the program to run (space required by the class/function name etc... ) is separate from any variables you would assign during runtime.

This is all assuming that your OS does support multiple processes executing in parallel - very old or very limited embedded systems may not even support this at all. A lot of boards you work on (in school) do not support something like this and you have to write it on your own.

When you call the same program with separate files, each file exists within it's own memory space. No, they are not labelled as such. Do not try to guess what the names are after compilation. It just doesn't work.

why?

1)It's compiler dependent. Different compilers use different ways.

2)It's not human readable (unless your write the compiler yourself)(Correct me if I'm wrong)

The OS/compiler gives them a unique name (could be time dependent, os dependent or a a hundred other things). The programs do not know about each other and run in their own space.

Credit : @Hulk @Mohammad Ali Baydoun

Rahul Shardha
  • 399
  • 7
  • 16
  • `The OS/compiler gives them a unique name (could be time dependent, os dependent or a a hundred other things). The programs do not know about each other and run in their own space.` Ok, that's at the moment enough for me to know. thx – Streight Dec 02 '13 at 15:58