In: Computer Science
Assembly Language
2. Suppose the processor is executing at the fix speed 755MHz. After how much time will the 32-bit counter overflow?
3. What exactly happens when “ret” (asm) or “return” (C++) executes?
4. What is the precise name of the greatest program ever built in assembly language?
Solution(a) :
Given,The speed of processor is = 755 MHz
and, 1 MHz= 10-3 GHz = 106 Hz
so, 755 MHz = 755 *106 Hz
Also, the counter is of 32 bit .
so,the total increments possible in counter = 232.
now, the total time required(in seconds ) , so that the counter overflows = ( total increments possible ) / speed of processor clock (in hertz)
= (232 ) / ( 755 * 106 ) seconds
= 4294.967296 / 755 seconds
= 5.7 seconds (approximately).
So,After 5.7 seconds (approximately) ,the 32-bit counter will overflow.
Solution (b) :
Whenever a "ret" command in assembly language or a " return " statement in C++ executes the following thing happens :
(i) It stops the execution of the current function being run in the memory (primary). This means the function which is currently loaded in the primary memory will stop its execution when return statement/ command is called and hence the function will not be able to run its next command in the queue.
(ii) When the "ret" in assembly language or the "return " in C++ language is run the control goes back to the place from where the current function was called. This means the current function will stop and will give back the control to the parent program or the parent function.
(iii) If the return statement / command is initiated then the program stack will unwind itself one step before the current function, which means the program counter which points to the top of the program stack will pop one value and will decrements its value by one.
(iv) The current function will return the required value to the calling function so that scheduling is processed in a proper manner.
Solution (C) :
The Greatest program ever built in an assembly language is named "SDOS". SDOS is an 8-bit operating system which was built in early 80s ,initially for the computational purpose in the advanced systems at that time.It consisted of more than 27K line of the assembly language instructions or commands.