Ahmad Naoum
Ahmad Naoum

Reputation: 675

Assembly - How OS knows the size of program and variables from COM file before loading it?

I read that the com file contains the instructions only, so how OS knows the size of program and variables from COM file before loading it? Also how CPU identify the variables?

Upvotes: 0

Views: 56

Answers (1)

rcgldr
rcgldr

Reputation: 28921

In the case of MSDOS, it doesn't know the size, so it allocates all of the available memory for the .COM program. If the .COM program is going to terminate and stay resident, it can release the memory that it doesn't need before exiting.

Upvotes: 4

Related Questions