Re: [algogeeks] Doubts about realloc

2011-09-23 Thread sukran dhawan
yes realloc can be used to shrink the allocated memory. yes the remaining memory will be freed. IF we want to allocate more memory and if there is no enough room in that particular boundary, i will allocate a new block ,copy the contents and free the previous contents On Thu, Sep 22, 2011 at

[algogeeks] Doubts about realloc

2011-09-22 Thread Ankuj Gupta
Hi I have a doubt in functioning of realloc. Can we use realloc to shrink the memory already allocated ? If yes, will it also free the left over memory or programmer has to do it ? Also, while reallocating if it has to move to some other location does the earlier location gets freed or is it

Re: [algogeeks] Doubts

2011-08-09 Thread aditi garg
@aditya and dipankar: the ans given ws 500ns that is why i posted dis ques...i ws getting the same ans... On Tue, Aug 9, 2011 at 9:45 AM, ankit sambyal ankitsamb...@gmail.comwrote: @aditya : can u explain how u got c part as the answer for question 2 -- You received this message because you

Re: [algogeeks] Doubts

2011-08-09 Thread Rohit Srivastava
@aditi did they mention any thing about miss penalty also in the question ?? On Tue, Aug 9, 2011 at 11:48 AM, aditi garg aditi.garg.6...@gmail.comwrote: @aditya and dipankar: the ans given ws 500ns that is why i posted dis ques...i ws getting the same ans... On Tue, Aug 9, 2011 at 9:45 AM,

Re: [algogeeks] Doubts

2011-08-09 Thread aditi garg
@Rohit:No...i directly copy pasted the ques...nothing else mentioned...and what if thr ws sm miss penalty?what wud be the change in soution? On Tue, Aug 9, 2011 at 1:37 PM, Rohit Srivastava access2ro...@gmail.comwrote: @aditi did they mention any thing about miss penalty also in the question

Re: [algogeeks] Doubts

2011-08-09 Thread Rohit Srivastava
yup !!! it will increase the avg access time On Tue, Aug 9, 2011 at 1:39 PM, aditi garg aditi.garg.6...@gmail.comwrote: @Rohit:No...i directly copy pasted the ques...nothing else mentioned...and what if thr ws sm miss penalty?what wud be the change in soution? On Tue, Aug 9, 2011 at 1:37

[algogeeks] Doubts

2011-08-08 Thread aditi garg
Q1.in a memory hierarchy, M1,M2 M1 access time is 2 ns ,M2 accesstime is 100 ns . the hit ratio for M1 is .97, then what's the avg access time? Q2.two heaps of sizes m,n are given, then the time needed to merge them a)m b)n c)m+n d) none Q3.context switching is useful in a) spooling b) polling

[algogeeks] Doubts

2011-08-08 Thread aditi garg
Q1.in a memory hierarchy, M1,M2 M1 access time is 2 ns ,M2 accesstime is 100 ns . the hit ratio for M1 is .97, then what's the avg access time? Q2.two heaps of sizes m,n are given, then the time needed to merge them a)m b)n c)m+n d) none Q3.context switching is useful in a) spooling b) polling

Re: [algogeeks] Doubts

2011-08-08 Thread Aditya Virmani
4.94 ns c c b On Tue, Aug 9, 2011 at 1:32 AM, aditi garg aditi.garg.6...@gmail.comwrote: Q1.in a memory hierarchy, M1,M2 M1 access time is 2 ns ,M2 accesstime is 100 ns . the hit ratio for M1 is .97, then what's the avg access time? Q2.two heaps of sizes m,n are given, then the time needed

Re: [algogeeks] Doubts

2011-08-08 Thread aditi garg
can u explain ques 3 and 4? Fr ques 3 why not interrupt servicing? and in 4 why not both? On Tue, Aug 9, 2011 at 1:42 AM, Aditya Virmani virmanisadi...@gmail.comwrote: 4.94 ns c c b On Tue, Aug 9, 2011 at 1:32 AM, aditi garg aditi.garg.6...@gmail.comwrote: Q1.in a memory hierarchy,

Re: [algogeeks] Doubts

2011-08-08 Thread Raman
For ques 3, remember that context switch is useful in 3 situations : 1. Multitasking (when CPU is to be switched among processes(usually preemptive)) 2. Interrupt Handling (different from interrupt servicing) - In this, CPU requests for a service (eg read from a disk) but doesnt wait for it to

Re: [algogeeks] Doubts

2011-08-08 Thread Dipankar Patro
In hierarchy M1-M2 0.97 Hit = 2x0.97 = 1.94 ns M2 is not accessed in case of hit 0.03 Miss = 0.03x100 = 3ns (miss rate x miss penalty) Total = 4.94ns +1 to Aditya so the average access time is = hit + miss = 1.94 + 100.06 On 9 August 2011 08:11, Raman raman.u...@gmail.com wrote: For ques 3,

Re: [algogeeks] Doubts

2011-08-08 Thread Dipankar Patro
Sorry for the last line.. Made some error before. On 9 August 2011 08:51, Dipankar Patro dip10c...@gmail.com wrote: In hierarchy M1-M2 0.97 Hit = 2x0.97 = 1.94 ns M2 is not accessed in case of hit 0.03 Miss = 0.03x100 = 3ns (miss rate x miss penalty) Total = 4.94ns +1 to Aditya so the

Re: [algogeeks] Doubts

2011-08-08 Thread ankit sambyal
@aditya : can u explain how u got c part as the answer for question 2 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to