L-5.7: GATE 2007 Question Solved on First Fit,Best Fit and Worst fit with timeline |Operating System
Вставка
- Опубліковано 12 жов 2024
- 👉Subscribe to our new channel: / @varunainashots
In this video we have discussed GATE 2007 Question Solved on First Fit, Best Fit and Worst fit.
►Operating System (Complete Playlist):
• Operating System (Comp...
Other subject-wise playlist Links:
--------------------------------------------------------------------------------------------------------------------------------------
►Design and Analysis of algorithms (DAA):
• Design and Analysis of...
►Database Management System:
• DBMS (Database Managem...
► Theory of Computation
• TOC(Theory of Computat...
►Artificial Intelligence:
• Artificial Intelligenc...
►Computer Networks (Complete Playlist):
• Computer Networks (Com...
►Computer Architecture (Complete Playlist):
• Computer Organization ...
►Structured Query Language (SQL):
• Structured Query Langu...
►Discrete Mathematics:
• Discrete Mathematics
►Compiler Design:
• Compiler Design (Compl...
►Number System:
• Number system
►Cloud Computing & BIG Data:
• Cloud Computing & BIG ...
►Software Engineering:
• Software Engineering
►Data Structure:
• Data Structure
►Graph Theory:
• Graph Theory
►Programming in C:
• C Programming
►Digital Logic:
• Digital Logic (Complet...
---------------------------------------------------------------------------------------------------------------------------------------
Our social media Links:
► Subscribe to us on UA-cam: / gatesmashers
►Subscribe to our new channel: / @varunainashots
► Like our page on Facebook: / gatesmashers
► Follow us on Instagram: / gate.smashers
► Follow us on Instagram: / varunainashots
► Follow us on Telegram: t.me/gatesmash...
► Follow us on Threads: www.threads.ne...
--------------------------------------------------------------------------------------------------------------------------------------
►For Any Query, Suggestion or notes contribution:
Email us at: gatesmashers2018@gmail.com
moral of the story: khali ho to kam pe lag jao "better" time slot ka wait mat karo
ab ye question ka trick hamehsa yad rahega
😂😂👌🏻
👍
Regarding doubts,
Consider this problem as fixed partition one as partition of memory is already given in question
Thanks 🙏🙏🙏
thanks a lot
Thank you
but when we insert 14k p2 in 20k then we have extra space which is 6k then when we insert p4 which size is 6k then why it wait until p2 does not completely executed.
@@ajaygoswami49 did u get the answer? i too got same doubt
Thank you for sharing this question! It was a bit tricky and of different pattern than the other numericals discussed on partitioning! But you did so well at explaining!
sir why don't you put j4 in remaining part of 2 block? cause 20-14 is 6 that is best fit for j4
because it is static partitioning
Fixed partitioning
Awesome 👍. In this age your exp. Of teaching is like 60 year professor. You keep everything in mind while explaining
Sir, please visit this question again. It does not seem correct. Firstly, 20K slot could have accomodated by J5. J1 - J5 will be finished at 10. This will give room for J6 and J7 (10K + 7K < 20K). The answer must be 18 in that case.
the question is for fixed partition scheme, so you can't place J5 at 20K until J2 is completed.
@@aryan20052 Thank you, I was also having same doubt
@siddh_15_5no
@siddh_15_5 Fitting algorithms are for contiguous memory allocation. That means for fixed allocation too
sir, please solve more and more gate previous year question as this would be really helpful and Thank you for your kind efforts
sir one thing should also be mentioned in this question by you is that it is fixed partitioned memory allocation ,as fixed algo is used in both case . but still you should mentioned that.
Happy Teachers day sir, preparing for my campus placements and your videos really helping me alot. Thanks 🙏🙏
All the best.. Lots of blessings
@@GateSmashers Thankyou sir
@@niwanshumaheshwari4534 Sir, lag gayi kya placement??
{Even i am a 4th year clg student now and just curious to know about it}
*This comment is for them who has confusion at J5*
It is Fixed partition contiguous memory allocation in which number of partition are given and no spanning at all.
As Fixed Partition , after J4 , it's slot is full (no holes) then we have to make place for J5. Someone has to execute(process) And it is 1st position 'J4' because J4 is executing before J2 a/c to time. Then Your Arrival time of J5 is 8 and burst time is 4 makes total 12(8+4=12).Vice Versa solve all.
It create me a problem also so I thought it would be great to share with colleague's.
But if you watch the previous video of best fit algorithm, at that time sir consecutively allocated the processes if the remaining hole was sufficient enough for the next processes.
for first fit and next fit also would be same logic ?
Great Stuff! But after assigning j2 6kb is left in the 3rd hole which can fit j4 perfectly. This changes the answer as well. I am a bit confused here.
I have the same doubt too.
Yes, may be they forgot , what you are saying is absolutely correct , no need to confuse , solve it and after solving 19k will be answer.
You guys are wrong. This memory is not variable size partitioned this is fixed size partitioned. As partitions are fixed before arrival of process and once a process occupies a partition it cannot be used by another process. The space is totally wasted. You cannot use that leftover 6k space
Mai be
Then answer will be 27 which is not in option 🌚
Sir J2 should be there till 14 seconds because burst time or usage time is 10 seconds. So 4 for J1 + 10 for J2= 14 seconds. Please reply ASAP. Btw you are the best teacher of OS till date.
Struggling with this question and spend many time , when I found your video, Got cleared !
Awesome work Varun! :) Please solve more gate questions if possible!
Easy to think of it like this : Best fit comes into play only when there are multiple free holes available.If there is only a single free hole at the specific time of arrival of job,then no question of best ft.We need to use that slot itself.
this is the question of fixed partition and not variable partition because the partition are given to us . and in fixed partition spanning is not allowed so one partition can have only one process
subscribed all by my heart....you are my best fit..haha.. love from nepal
Despite not speaking Hindi (I assume you're speaking Hindi) your lectures are so clear to me. I must congratulate you. Great teacher!
Sir y we didn't put j4 with j2 as j2 occupied 14k nd we had 6k empty space nd we are using best fit???
fixed partitioning
given in the question but not mentioned in the video
Sir, I doubt you only said that in best-fit look for minimum internal fragmentation. So when we assigned J2 in the 20k slot there was a hole created of 6k size and we could have efficiently allocated J4 to that as it fits entirely there. But we didn't do that Why ??
did u find out the answer??? if so please tell me
why didn't we allocated in the 20k slot
@@dixxanta It is fixed size partitioning not variable sized
Great trick question sir, Thank you.
Sir i also thought the answer is 20 but now its clear its 19.. thank you sir👍👍
This is static partitioning not dynamic partitioning, both static and dynamic are contiguous memory allocation. This is reason we can't put a memory section in segment even if place is enough because it is already occupied.
Best lesson from this video, LIVE THE PRESENT, DON'T THINK ABOUT FUTURE.
Hello sir ,
I wanna ask you that when we hv put job j2 .. left slot size is 6k as a hole . So when job j4 came of 6k we should put it thr acc to best fit ..n j5 in 8k slot .. in that case answer will b 12
yeah thats tru
@@inosuke44 u r my best fit
Yeah You are right.
I have same question
@@inosuke44 Bro fits can be applied to CONTIGUOUS MEMORY on the whole not just VARIABLE PARTITIONING. Variable partitioning just help in dynamic allocation in the start. First clear your concepts then try to answer
Amazing teaching skills...🤗🤗
I enjoying a lot...
Thank you sir... ❤️❤️❤️❤️
sir mja aagya iss lecture me gajab question tha
Sir wrong error : If j2 = 14k in 20k block so 20k - 14k = 6k left in 2nd block. So j4 fit in 2nd block not in 1st block. And j5 in 1st block and then at 10 sec all blocks become empty and j6 = 10k put in 2nd block and j7 put in 1st block from 10 to 8 sec = 18sec. will be answer.
Oops i am The One of 90% jo ye Soch rhi thi.. ki J7 12 pr Jaaega... But you Opened my Eyes...!!
Thank you So much Sir
Nub
You're braindead just like those 90% people
This Question was asked in KIIT END-SEM 2019 for 4 Marks ... BTW Thanks a lot Sir
The saviourrrrrr for college students!!!!!!!!😇😇
Sir, why did you not put the process in the free space created after process allocation?
Bro because partioning technique is variable size partition in which no. Of memory slot is fixed
@@divyamdubey2334 i think u want to say fixed size partiition.....
Kamal ka smjhate ho ap. Thank you so much sir. God bless you😇
sir you are considering it as fixed partitioning right. If its dynamics partitioning than time taken is less comparatively.Please answer to this sir.
yess,but the sizes of partitions are already mentioned here so it is a case of fixed partitioning
@@yoshidasan4780 isse pehla wala question mai bhi to size mentioned tha
@@learncseasily3385 areyy wo process ke hisab sey partition ho raha tha ...isiliye dynamic partitioning
@@yoshidasan4780 abh bhi samajh ni aya yaar isse pehle wala gate question ka video mai jo question tha aise to diagram tha sirf 0 , 1 , 2 yeh numbers mentioned ni tha . Mujhe pata kaise challega ki fixed partitioned hai ya variable partitioned hai?
@@learncseasily3385 pata chala ki aisa kyu huwa?
sir 1 mistake, 20k wale slot me 6k remaining hole h to best fit k according j4 usi me jayega
That would be in the case of dynamic, partitioning. Not in fixed size partitioning.
@@Harish-fx2mo but in this question it is not mentioned that it is of fixed partitioning type than variable partitioning So how come we know which method do we have to solve this using??
20k slot have 6k remaining hole..
so j4 will placed ....
j5 placed at 8k slot.
remaining 2 k (time 4)
j6 can enter after completed j2...(time 10+1=11)
j7 can enter after completed j6(time 11+8=19)
so answer 19
@@riyaroy5382 but you have to solve using fixed size partitioning!
The fitting algorithms can be applied for both fixed and dynamic memory allocation schemes. Even if you're using 'best-fit'.
Check www.geeksforgeeks.org/best-fit-allocation-in-operating-system/
Holes are created in both fixed and dynamic memory allocation schemes. It's just that during fixed memory allocation, there's no external fragmentation as spanning is not allowed and hence, compaction cannot be used to combine the remaining holes to place an incoming process into the memory.
20k slot have 6k remaining hole..
so j4 will placed ....
j5 placed at 8k slot.
remaining 2 k (time 4)
j6 can enter after completed j2...(time 10+1=11)
j7 can enter after completed j6(time 11+8=19)
so answer 19
great sir keep rocking on
Best explanation sir
nice sir ji , its very important for less time can be clear all concept of os , amazing , explaination sir.
Superb sir aap great ho sir 👌👌👌
I think this is fixed size partitioning technique even sir is using the word Slots that means those are slots and slots are created in fixed size partitioning technique
excellent teaching style sir!!!
Sir why we cannot allocate 6k of 3 slot to j4 job.... As you explained in last video of best fit first fit
Have you figured it out? I was also thing the same thing. On the other hand since he is not tracking free space there is a possibililty he might have missed it.
We have to follow fixed partition therefore at a time we can put one process in 1 block
@@Sagar-it5mf how do we know if it is fixed or variable?
But although if I consider it is the fixed size partion then also we can accommodate this j4(6k) cause here we don't split the process......the whole process itself can accommodate within this 3rd hole portion
Well described. Thank you 🙏
this was an eye-opening question!!!!!!!!!!!!!!!!
this question was really great ..................one level up question
I watched Playlist whole but this video is best
It works! Thanks a lot.
What a simplified explanation..thnku sir
God bless u sir... thank u so much
I have a question, when we use the 20k slot to store J2(14 k), we ate left with 6k memory in the slot.... Can't we use the 6k memory to store other jobs...???
Exactly sbhi ko yhi doubt h
very helpful sir.....Thank you👍
sir i have a doubt when filling j2 to the 20k slot as the j2 have only 14k so we have remaining 6k on that perticular hole so why you are not putting j4 on that remaining 6k hole ?
Excellent👍👏
i have a doubt, as it best fit so why we dont fill J4 at remaning portion where J2 filled because it left 6k space where we can fill J4 as well we fill J5 at 8k
This was really too helpful..Thanks for all your efforts
but if we consider the 20k block to leave behind 6k hole it can be used by J5 and then J6 takes the 20k hole at 10 second when J2 ends. In this moment J7 is assigned to the 8k hole since all the previous jobs have already completed before the 10 second mark and J7 should take 10+8 = 18 time which is not an option.
@GateSmashers sir please visit this question again because job allocation is not proper way🙏🙏🙏
Assume J6 request size to be 4k.
At time 2, can we place J6 in the 4k partition or should we wait for J5 to be placed first ?
6:54 why we not allocating J4 job in remaining part of 2 memory space that is 6 k(20k-14k) ?
Great sir
For all those who are getting confused over 6k remaining of the 20k slot........here the question is based on Fixed partitioning and not dynamic.....means the partition remains fixed.......IN FIXED PARTITION ...EACH PARTITION IS ALLOWED TO CONTAIN ONLY ONE PROCESS !!! ......and here we have these 4 (0, 1, 2, 3) numbered fixed partitions.
yes 1 partition me ek hi process allocate hoga .
How do we know question is of fixed partitioning, in previous video also it didn't had it mentioned that it is having variable partitioning?
If j7 had waited 1s then it would complete in 20 and space hold by j6 could have been allocated to j8 whose end time would be 20 which is 9 less than 39 as we did opposite because as space became available we just put in processses
Since we are assuming here that all the jobs have arrived at time 0, why are we checking sequentially as j1, j2, j3... We can put j7 at time 0 also and then the answer should be 8
I too have the same doubt....
I have one doubt after, filling J2 at 20k position we have 6k space left, so instead of putting J4 and J5 in slot of 8k why not put it there at the left space bcz this is 'Best Fit' no internal fragmentation will occur as when we put it in 8k slot 2k internal fragmentation will occur also there is no such rule that it should go in the first left space. Best fit searches the whole memory block...
its fixed partitioning q ig
@GateSmashers sir please revisit this question again
In partition 2, J6 was residing with an empty space of 10K (as partition size is of 20K), so why not J7 entered to RAM in partition 2 at time 10? Why it has to wait for J6 to complete even when an empty slot is there??
10:53
Some tips for Operating System Exam:
1) Even memory got holes but you didn't.
2) Hey girl are you memory allocation method coz I have the best fit for hole.
3) Hey girl are you starvation coz I am always starving for you.
4) Hey girl are you ostrich algorithm coz you always ignoring me.
5) Hey girl are you the spaghetti of dining philosopher problem coz I am thinking about you and you are being eaten by others.
6) Hey girl are you mutual exclusion coz I wanna enter your heart but it's already occupied by someone else.
Thanks!
still don't get why the 6K left out by J2 is not used by other processes
thnkk u so much sir....god bless u always...sir
Awesome
after allocating 14k for J2 ,6k was remaning then why cant we allocate that 6k for j5 rather tha waiting for j4 to exit?
Sir, after we fit the J2 in 20K slot still we have 6k hole left in that partition so we can accommodate the J5 process which is off 6K in that 20K slot at time zero. Please check if my argument is correct if not please clarify where I am wrong.
its not a hole its internal fragmentation issue...hole is in dynamic partitioning when a process is terminated it leaves behind some space which can't be used. Compaction is a solution to this but not recommended.
Hello sir,
I also have a doubt that we r using best fit and we r having 6k left over space in the 20k. partition after allocating j2=14k,so why we are not allocating j4 to the 20k block as it is best fit so we will search the entire list then only we can allocate the jobs.So why you have not allocated j4 to that 6k leftover space of 20k partition????
Sir I have a doubt... why you use full partition as whole, why are you not use the process size space... like j2 and j4 both accommodate that partition but you use only j2 ... why??????
I have got the same doubt, because best fit is dynamic memory allocation algo and if we put j4 in the remaining 6k of 20k block we will get a different answer. So wanted to know which is the correct approach.
@@debasishdas2088 SAME DOUBT
same doubt here 🤔🤔
Because here the question is on fixed sized partitioning, not variable sized partitioning.
Sir can you please clarify our confusion?????🙏🏼it will be really very much helpful
Sir I have question that in 20 k slot there is space for 6k but u will not put here
can anyone explain it??
@@saurabhsuman318 because it is contiguous memory allocation.. and also in that it's fixed partitioning..
In contiguous memory allocation we cannot place more than one process in one block..
at 9:55 you can listen what sir said..
Hope it helped!
Bahut maja aa gaya sir
How you are determining whether it is static or dynamic....here u use static fixed continuos memory allocation
NOTE: It should be provided that it is Fixed Partition Quetion.
Self referential note: this video is important
Jyada self referential notes mat bato
@@thepriestofvaranasi sorry,par yeh actually mere exams time pe padhne ke liye mark kiya hua hai.
@@sahilprasantachoudhury911 pata hai bro mai mazak kar raha tha...waise idea accha hai yaad rakhne ke liye agar kuch imp notes hai toh😬
@@thepriestofvaranasi thank you ☺️
@6:06 why are we not using the remaing space in the hole left by J2 which is 6K?
after time 2, J3 will leave (in address block 0)
@4, J1(3) J5(1)
@8, J4(2[14-19])
@10, J2(2[0-13])
now all the blocks are occupied
J6 need 10 now so it will wait for J2 to finish and it will finish its task from 11to 11+1 = 12
J7 needs 7 now it will wait for J4 to finish to take up Mem, Block 1 and will start from 9 to 9+8 = 17
Hence 17 is the answer
at 14:00 , which is question 2, why do we allocate j7 at 11 when we are following best fit acc to the question given ?
👍👍👍
Thank you sir
Thanks sir
Thank you so much sir...🙏
Best 👍💯
sir, why aren't we considering the internal fragmented memory?
when the request j3 came you said there's only one slot(which is 1) is available but could it not goto the slot 2 since it had 6k extra?
Sir I have a doubt here that after accomodating j2 there is a space left of 6k.and it's a case of best fit so according to that we need a smallest possible hole for allocation.so why didn't you place j4 in 20k(2 partition) instead of 8k(1 partition).
Yes u r right
This is because, it will start to find the best fit from the beginning rather than from previous memory location. So first it encounters the top 8k block.
Hope I am right..!
In fixed partition the entire 20k block will be allocated to the job...that is one of the disadvantages in fixed sized partitioning as internal fragmentation occurs
@@hasslefreelabs in best fit see defination it always iterate over the entire memory to find the minimum possible hole
Thank You SIr
why are we not using hole space 6k created by J2
I think the answer is c ie 20
As
J1 occupies 2kb ie 2kb in main memory(mm) for 4 sec
J2 occupies 20kb for 10 sec
J3 occupies 4kb for 2 sec
J4 occupies 8kb for 8 sec
J5 occupies 8 kb for 4 sec(J4+J5 =>8sec+4sec=12)
J6 occupies 10kb for 1 sec(J2+J6=>10sec+1sec=11sec)
J7 occupies 7kb for 8 sec(J4+J5+J7=> 8+4+8=20sec)
If wrong crt me
At time 11 , j7 and j8 both are available so 20k block must be allocated to j8 (not to j7) as internal fragmentation will be minimum according to best fit and the answer must be 20. please explain if I am wrong?
Sir please solve more problems on this topic pleaseeee
Thank you sir....