OS ဟာ Application နဲ႔ hardware ရဲ႕ interface အျဖစ္ လုပ္ေဆာင္ပါတယ္။ User က hardware ကုိ တျခားနည္းလမ္းနဲ႔ ထိန္းခ်ဳပ္တာလုိ႔ ေျပာလုိ႔ ရတယ္။ OS ဆုိတာ a set of services which simplifies development of applications လုိ႔ေျပာလုိ႔ ရတယ္။ Program ေတြ run ရာမွာ OS ရဲ႕ process ေတြ ဖန္တီးေပးတာက အေရးပါပါတယ္။ အဲဒီမွာ kernel က အဲဒီ process အတြက္ memory assign လုပ္ေပးပါတယ္။ Resources ေတြကုိ assign လုပ္ေပးပါတယ္။ process ေတြကုိ အစီအစဥ္တက် စီစဥ္ေပးပါတယ္။ (in multitasking system ) (loading program code to memory and execute the program) ဒီလုိနဲ႔ Program ဟာ user နဲ႔ တျခား device ေတြနဲ႔ ဆက္သြယ္ျပီး သူ႔ function ကုိ ၿပီးေအာင္ လုပ္ေဆာင္သြားပါတယ္။
Interrupts
Interrupts are central to operating systems as they provide an efficient way for the operating system to interact and react to its environment. ၾကားျဖတ္ျခင္းပါပဲ။ Interrupt တစ္ခုကုိ လက္ခံရျပီဆုိတာနဲ႔ Computer’s hardware automatically suspends whatever program is currently running, save its status ,and runs computer code previously associated with the interrupt. (interrupt နဲ႔ အတူပါလာတဲ့ code ကုိ တန္း run ပါတယ္။ ) ဥပမာ ဖုန္းဆက္ေနရင္း ေနာက္တစ္ call ၀င္လာရင္ အရင္ call ကုိ ခဏမွတ္ထားျပီး ေနာက္ဟာကုိ အရင္လုပ္တာပါပဲ။ ဒီ system’s interrupt ကုိ OS’s kernel ကုိ လုပ္ေဆာင္ပါတယ္။ Interrupt ဟာ hardware ေတြကေရာ ၊ running program ေတြကေရာလာႏုိင္ပါတယ္။ Hardware device တခုခုက interrupt လာျပီဆုိရင္ OS’s kernel က ဒါက ဘယ္လုိ event လဲ။ ဘာလဲ ဘယ္လုိ code ေတြလုိလဲ။ ဆုိတာဆံုးျဖတ္ပါတယ္။ Hardware interrupt ဆုိတာ device drivers က လုိအပ္တဲ့ အခ်ိန္မွာ ေပးလုိက္တဲ့ task တစ္ခု ျဖစ္ပါတယ္။
Memory management
Memory management ကုိ kernel ကသာလုပ္ေဆာင္ပါတယ္။ မေလာက္ရင္ harddisk ကေနယူသံုးပါတယ္။ swap file လုိ႔ window မွာေခၚပါတယ္။ Virtual memory addressing means that the kernel can choose what memory each program may use at any given time ,allowing the operating system to use the same memory location for multiple tasks. Swapping လုိ႔ေခၚပါတယ္။
Multitasking ဆုိတာကေတာ့ ကြန္ျပဴတာတစ္လံုးထဲမွာ မ်ားစြာေသာ မတူညီတဲ့ ပရုိဂရမ္မ်ားကုိ Run တာပါပဲ။ ကြန္ျပဴတာက တခ်ိန္တည္းမွာ အလုပ္အားလံုးကုိ လုပ္ေနတယ္လုိ႔ ထင္ရေစပါတယ္။ OS’skernel မွာ scheduler ဆုိတဲ့ software ေလးပါ ပါတယ္။သူက ပရုိဂရမ္တစ္ခုစီ အတြက္ အခ်ိန္ဘယ္ေလာက္သံုးေပးရမယ္ ဘယ္လုိအစီအစဥ္အတုိင္း ဒီပရုိဂရမ္ေတြကုိ Run ရမယ္ဆုိတာတြက္ခ်က္ေပးပါတယ္။ ေနာက္ kernel ကေနျပီး အဲဒီ Run မယ္ဆုိတဲ့ control process တစ္ခုကုိ pass လုပ္ပါတယ္။ အဲဒီ control ေလး kernel ဆီကုိ ျပန္ေရာက္တာနဲ႔ အဲဒီ program ဟာ CPU နဲ႔ memory ကုိအသံုးျပဳခြင့္ရသြားပါျပီ။ ဒီလုိ kernel နဲ႔ application ၾကား control passing ကုိ context switch လုိ႔ေခၚပါတယ္။ Pre-emptive multitasking ဆုိတာကလဲ time-shared scheduling ပါပဲ။ Preemptive multitasking involves the use of an interrupt mechanism which suspends the currently executing process and invokes a scheduler to determine which process should execute next. Therefore all processes will get some amount of CPU time at any given time.
Multitasking ဆုိတာကေတာ့ ကြန္ျပဴတာတစ္လံုးထဲမွာ မ်ားစြာေသာ မတူညီတဲ့ ပရုိဂရမ္မ်ားကုိ Run တာပါပဲ။ ကြန္ျပဴတာက တခ်ိန္တည္းမွာ အလုပ္အားလံုးကုိ လုပ္ေနတယ္လုိ႔ ထင္ရေစပါတယ္။ OS’skernel မွာ scheduler ဆုိတဲ့ software ေလးပါ ပါတယ္။သူက ပရုိဂရမ္တစ္ခုစီ အတြက္ အခ်ိန္ဘယ္ေလာက္သံုးေပးရမယ္ ဘယ္လုိအစီအစဥ္အတုိင္း ဒီပရုိဂရမ္ေတြကုိ Run ရမယ္ဆုိတာတြက္ခ်က္ေပးပါတယ္။ ေနာက္ kernel ကေနျပီး အဲဒီ Run မယ္ဆုိတဲ့ control process တစ္ခုကုိ pass လုပ္ပါတယ္။ အဲဒီ control ေလး kernel ဆီကုိ ျပန္ေရာက္တာနဲ႔ အဲဒီ program ဟာ CPU နဲ႔ memory ကုိအသံုးျပဳခြင့္ရသြားပါျပီ။ ဒီလုိ kernel နဲ႔ application ၾကား control passing ကုိ context switch လုိ႔ေခၚပါတယ္။ Pre-emptive multitasking ဆုိတာကလဲ time-shared scheduling ပါပဲ။ Preemptive multitasking involves the use of an interrupt mechanism which suspends the currently executing process and invokes a scheduler to determine which process should execute next. Therefore all processes will get some amount of CPU time at any given time.
ဆက္ပါဦးမယ္..
No comments:
Post a Comment