337 views
1 votes
1 votes
There are two segments supported by the hardware. Address spaces are small (1KB), and the amount of physical memory on the system is 16KB. Assume that the segment-0 base register has the value 1KB, and its bounds (size) is set to 300 bytes; this segment grows upward. Assume the segment 1-base register has the value 5KB in it, and its bound is also 300; this segment grows downward (the negative direction). Assume we have the following program:
int main() {
void *ptr = 20;
while (ptr<= 1024) {
int x = (int *) *ptr; // LINE 1: read what is at address ’ptr’
ptr = ptr + 20; // LINE 2: increment ’ptr’ to a new address
}
This program will run for __________ iterations before crashing due to a segmentation fault?

Please log in or register to answer this question.

Related questions

2 votes
2 votes
1 answer
1
ankit_thawal asked Jan 18, 2018
503 views
#include<stdio.h>void main(){printf("Hello\b\b\b\b\b");printf("Hi!\b\b\bBye");}
0 votes
0 votes
1 answer
2
Deepak Singh 7 asked Jul 5, 2018
188 views
If there are 'n' processor and 'm' processes then maximum process in block state can be? I think its m-n but answer is 'm' how?
0 votes
0 votes
0 answers
4
ankit_thawal asked Feb 1, 2018
429 views
Let x is a binary number and a functionf(x)= 1’s Complement(2’s Complement ( x ))If x= 0110 then f6(x)= ____.Note: fk(x)= f(fk-1(x)) ,k>1.