Theory
College Lab માં અંધાધૂંધી
કલ્પના કરો LabOne માં ઘૂસવું, તમારું college computer lab, જ્યાં 30 students બિલકુલ એ જ ક્ષણે એ જ server વાપરવાનો પ્રયાસ કરી રહ્યા છે. Rohit પોતાનું Python assignment print કરવા માંગે છે, Priya એક વિશાળ Java program compile કરી રહી છે, અને Amit એક dataset download કરી રહ્યો છે. માત્ર એક central processing unit, RAM નો એક મર્યાદિત pool, અને એક laser printer છે. જગ્યાએ એક સખ્ત system વગર, programs એકબીજાનો data overwrite કરી દેશે અને printer અલગ students ની મિશ્રિત lines print કરશે. system કેવી રીતે બચે છે?
Theory
Bank Branch Manager
operating system ને એક હોશિયાર bank manager ની જેમ વિચારો. CPU, memory, અને devices જેવા hardware components bank ના resources છે: cash counters, locker space, અને application forms. Customers એક સાથે અલગ માંગો સાથે આવે છે. manager બધાને એક વારમાં અંદર દોડવા દેતો નથી. એને બદલે, manager tokens આપે છે, ખાસ desks allocate કરે છે, queue manage કરે છે, અને પાકું કરે છે કે બે લોકો એક જ locker પર કબજો ન કરે. manager efficiency મહત્તમ કરે છે જ્યારે સંપૂર્ણ વ્યવસ્થા જાળવે છે.
Theory
વાત, ઔપચારિક રીતે
ઔપચારિક રીતે, એક operating system એક Resource Manager તરીકે કામ કરે છે જે એક computer system ના hardware resources ને નિયંત્રિત, allocate, અને coordinate કરે છે. user applications ને hardware સીધું પકડવા દેવાને બદલે, operating system બધી requests ને રોકે છે. એ એક resource allocator બંને તરીકે કામ કરે છે, એ નક્કી કરતાં કે CPU કે memory ને સ્પર્ધક programs વચ્ચે કેવી રીતે વહેંચવા, અને એક control program, errors અને અયોગ્ય hardware ઉપયોગ અટકાવતાં.
At a glance
operating system કેવી રીતે ચાર મૂળ subsystems માં resource management વહેંચે છે.
| Hardware Resource | Manager Subsystem | LabOne Server કાર્યવાહી |
|---|---|---|
| Processor (CPU) | CPU Scheduler | 30 student sessions માંથી દરેક એકને execution time ના નાના millisecond slots આપવા. |
| Memory (RAM) | Memory Manager | memory space ના અલગ blocks allocate કરવા જેથી Priya નો Java data Amit ની files ભ્રષ્ટ ન કરી શકે. |
| Storage (Disk) | File System | disk space ને individual student accounts માટે સુરક્ષિત directories માં વહેંચવો. |
| I/O Devices | Device Manager | print requests queue કરવી જેથી laser printer એક વારમાં એક પૂરો document સંભાળે. |
Think first
એક વહેંચેલા Resource અથડામણ ને ટ્રેસ કરવો
એક exam પ્રશ્ન પૂછે છે: 'સમજાવો કે એક operating system એક resource અથડામણ કેવી રીતે સંભાળે છે જ્યારે બે students LabOne પર બિલકુલ એ જ second પર print click કરે.' જવાબ પ્રગટ કરતાં પહેલાં resource management ના પગલાં વિશે મનમાં વિચારો.
Show the answer
Step 1: Device Manager ઘટક બંને print jobs ને રોકે છે.
Step 2: બંનેને એક સાથે printer hardware પર મોકલવાને બદલે, એ બીજા job ને memory માં એક waiting queue માં મૂકે છે.
Step 3: OS printer resource ને પહેલા student ના job ને પૂરું થાય ત્યાં સુધી વિશેષ રીતે allocate કરે છે.
Step 4: એક વાર printer એક empty signal મોકલે, OS resource release કરે અને એને queue માં આગળના job ને સોંપે છે, ભ્રષ્ટ pages અટકાવતાં.
Quiz
જ્યારે operating system નક્કી કરે છે કે કયો student program processor પર આગળ ચાલશે, એ કયું પ્રાથમિક resource management function ભજવી રહ્યું છે?
- Memory management
- Processor management
- Device management
- File management
Show the answer
Processor management
processor CPU છે. એ નક્કી કરવું કે કયો program CPU પર execute થાય છે processor management કે CPU scheduling કહેવાય છે. Memory management RAM allocations સંભાળે છે, device management printers જેવા peripherals સંભાળે છે, અને file management storage સંભાળે છે.
Watch out
Resource વિરુદ્ધ Interface નો ફાંદો
university exams માં એક સામાન્ય ભૂલ operating system ને માત્ર એક user interface કે desktop screen તરીકે વ્યાખ્યાયિત કરવી છે. જો તમે માત્ર wallpapers, icons, અને mouse clicks વિશે લખો, તમે મહત્તમ marks ગુમાવશો. Examiners ખાસ resource keywords જોવા માંગે છે: allocation, multiplexing, conflict resolution, અને hardware coordination. હંમેશા ભાર મૂકો કે interface બસ એક સુંદર આગળનો દરવાજો છે, પણ resource management ખરું engine room છે.
Quiz
શું થાય છે જો એક student program operating system ને bypass કરીને સીધું કોઈ બીજા program ના RAM address માં data લખવાનો પ્રયાસ કરે?
- hardware એને પરવાનગી આપે છે પણ student ને alert કરે છે
- operating system program ને block કરે અને એક memory violation error ફેંકે છે
- system બંને programs ને આપોઆપ એક સાથે merge કરી દે છે
- બીજો program પહેલા ના પૂરા થાય ત્યાં સુધી એક queue માં રાહ જુએ છે
Show the answer
operating system program ને block કરે અને એક memory violation error ફેંકે છે
operating system memory spaces ની કડક રીતે રક્ષા કરે છે. એક control program તરીકે, જો એ અલગ memory zones માં કોઈ અનધિકૃત પહોંચ શોધે, એ system ની રક્ષા માટે અપરાધી application ને તરત એક crash કે segmentation fault થી terminate કરી દે છે.
Theory
ખરી દુનિયાના Systems અને પછીના Semesters
તમે તમારી degree ભર આ management algorithms ને ઊંડાણથી ભણશો. Unit 2 માં, તમે બિલકુલ ગણતરી કરશો કે memory maps ને placement strategies વાપરીને કેવી રીતે partition કરાય છે. Semester 3 માં course BCA304 હેઠળ, તમે queues જેવી data structures બનાવશો જે એ બિલકુલ algorithms ને model કરે છે જેને એક OS processor time slots ને machine ને deadlock કર્યા વગર નિષ્પક્ષ રીતે manage કરવા વાપરે છે.
Summary
Key takeaways
- operating system બધા computer hardware components નો પ્રાથમિક manager છે.
- એ ચાર મૂળ ક્ષેત્રો manage કરે છે: processor time, memory space, storage access, અને input output peripheral devices.
- એ અથડામણ ઉકેલે છે જ્યારે અનેક applications કે users બિલકુલ એ જ hardware માટે એક સાથે સ્પર્ધા કરે છે.
- એ એક control program તરીકે કામ કરે છે જેથી memory boundaries ની રક્ષા કરે અને વ્યાપક system crashes ટાળે.
- Memory hook: CPU time schedule કરે છે, RAM space વહેંચે છે, files storage સુરક્ષિત કરે છે, અને drivers devices route કરે છે!