Operation System များအကြောင်း(၂)

Program execution

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.

ဆက်ပါဦးမယ်..

Generating the Keystream Letters

ဒီမှာ အဓိကကျတာ keystream ဆိုတာပြောခဲ့ပြီးပါပြီ ..အဲဒီ keystream ကို solitaire ကနေ ဘယ်လိုထုတ်မလဲ .. Solitaire ဟာ keystream ကို ဖဲထုတ်ကို အသုံးပြုပြီးဖော်ရပါတယ် ။ ဖဲထုတ်မှာ 13*4=52 + 2 joker = 54 cards ရှိပါတယ်။ ဖဲထုတ်မှာ ကတ်တွေ တည်ရှိနေနိုင်ပုံက 54 ! = 2.31*10^71 လောက်ဖြစ်နိုင်ပါတယ်။ solitaire အသုံးပြုဖို့အတွက် အဲဒီ 54 ကတ်လုံးကို အသုံးပြုပါမယ် ။ joker နှစ်ခုရှိတာကို တစ်ခုစီကို သီးခြားမှတ်သားထားပါ ။ နောက်ပိုင်းမှာ joker A နဲ့ joker B ဆိုပြီးအသုံးပြုမှာ ဖြစ်ပါတယ်။ (အမှတ်အသားကိုတော့ joker ပေါ်မှာပဲ တစ်ခုပေါ်မှာ A ၊ တစ်ခုပေါ်မှာ B လို့ ရေးထားရင် လုံလောက်ပါပြီ ) solitaire ကနေ keystream ကို အောက်ပါ အဆင့်များအတိုင်းလုပ်ပြီး ဖော်ရပါမယ်။
၁။ joker A ကိုရှာပါ။ အဲဒီ joker ကိုယူပြီး အောက်ဘက်ကို တစ်ကတ်ရွှေ့ပါ။
၂။ joker B ကိုရှာပါ။ အဲဒီ joker ကိုယူပြီး အောက်ဘက်ကို နှစ်ကတ်ရွှေ့ပါ။ဖဲချပ်တွေကို အပေါ်ဆုံးနဲ့ အောက်ဆုံးဖဲချပ်က ဆက်နေတယ်လို့ ယူဆပေးပါ။
ဥပမာ ၁။ ဖဲချပ်တည်နေပုံက A 7 2 B 9 4 1 ဆိုပါစို့ ။ step 2 ပြီးသွားတဲ့ အချိန်မှာတော့ အောက်ပါအတိုင်းဖြစ်နေပါလိမ့်မယ်။ 7 A 2 9 4 B 1
ဥပမာ ၂။ ဖဲချပ်တည်နေပုံက 3 A B 8 9 6 ဆိုပါစို့ ။ step 2 ပြီးသွားတဲ့ အချိန်မှာတော့ အောက်ပါအတိုင်းဖြစ်နေပါလိမ့်မယ်။
3 A 8 B 9 6
၃။ Triple cut လို့ခေါ်ပါတယ်။ joker A နဲ့ B ကို ရှာပါ ။ joker A နဲ့ B ရဲ့ ကြားထဲက ဖဲချပ်များကို ချန်ပြီး joker ရဲ့ အပေါ်နဲ့ အောက်က ဖဲချပ်များ ကို တစ်ခု နဲ့ တစ်ခု နေရာချိန်းပါ။ joker ဖဲချပ်က A ဖြစ်ဖြစ် B ဖြစ်ဖြစ် ရပါတယ် ။
ဥပမာ။
2 4 6 B 5 8 7 1 A 3 9 ဆိုရင် Triple cut လုပ်ပြီးတဲ့အခါမှာ 3 9 B 5 8 7 1 A 2 4 6 ဖြစ်သွားပါလိမ့်မယ်။ အကယ်လို့ joker က ထိပ်ဆုံး သို့ အောက်ဆုံးကို ရောက်နေရင်လည်း အောက်ပါအတိုင်းနေရာလဲပါ။
B 5 8 7 1 A 3 9 ဆိုပါစို့ ။
3 9 B 5 8 7 1 A ဖြစ်သွားပါမယ် ။
B 5 8 7 1 A ကတော့ မပြောင်းလဲပါဘူး ။
၄။ Count cut လို့ ခေါ်ပါတယ် ။ ဖဲထုပ်အောက်ဆုံးကတ်ကို ကြည့်ပါမယ်။ သူ့တန်ဖိုးအတိုင်း အပေါ်ဆုံး ကတ်ကနေ စရေတွက်ပြီးယူပါမယ် ။ ပြီးရင် အဲဒီကတ်တွေကို အောက်ဆုံးကတ်ရဲ့ ရှေ့မှာ ကပ်ပြီးထည့်ပါမယ်။ ကတ်တန်ဖိုးယူတဲ့အခါမှာ ညှင်း . ဒေါင့် . ဟတ် . စပိတ် ဆိုပြီးစီရပါမယ် ။ ဆိုလိုတာက ညှင်းဆိုရင် မူရင်း တန်ဖိုး ဒေါင့် ဆိုရင် မူရင်းတန်ဖိုး + ၁၃ ဖြစ်ပါမယ် ။ဟတ်ဆိုရင် မူရင်းတန်ဖိုး+၂၆ ဖြစ်ပါမယ် ။ joker နှစ်ခုလုံး တန်ဖိုးကိုတော့ ၅၃ လို့ပဲ ယူဆပါမယ် ။ ၅၃ ဆိုရင်တော့ ဖဲထုပ်ဟာ ဒီအတိုင်းပဲ ရှိနေမှာ ဖြစ်ပါတယ် ။(ဖဲ ၅၄ ချပ် သာရှိလို့ပါ)
ဥပမာ။ ….. 4 5 ….. … 8 9 ဆိုပါတော့ ။ ရှေ့ဆုံးကနေပြီး ၉ ကတ်မြောက်က ၄ ဖြစ်မယ်ဆိုရင် ၄ အထိ ကတ်တွေအားလုံးကို ယူပြီး နောက်ဆုံးကတ်ဖြစ်တဲ့ ၉ ရဲ့ အရှေ့မှာကပ်ထားရပါမယ် ။ ဒါဆိုရင် 5…. ……. 8 …. .. … .4 9 ဖြစ်သွား ပါလိမ့်မယ်။
၅။ Output card ကိုရှာပါမယ်။ ဖဲထုပ်အပေါ်ဆုံးအချပ်ကို ကြည့်ပါ။ သူ့တန်ဖိုးအတိုင်း အပေါ်ဆုံးကနေ စပြီး ရေတွက်ပါ။ ကျတဲ့ကတ်က ပထမဆုံး output card ပါပဲ။ ကတ်တွေရဲ့ တန်ဖိုးကိုတော့ အဆင့် (၄)မှာ ယူတဲ့ အတိုင်းယူပါ။ အကယ်လို့ ကျတဲ့ကတ်က joker ဆိုရင်တော့ keystream မှာ အဲဒီနေရာမှာ null လို့ ယူဆ ပါမယ်။
၆။ Output card ကနေ number ကိုပြောင်းပါမယ်။အောက်ပါအတိုင်းပြောင်းပါ။
၁ ညှင်း မှ ကင်း ညှင်း အထိ ၁ မှ ၁၃
၁ ဒေါင့် မှ ကင်း ဒေါင့် အထိ ၁၄ မှ ၂၆
၁ ဟတ် မှ ကင်း ဟတ် အထိ ၁ မှ ၁၃
၁ စပိတ် မှ ကင်း စပိတ် အထိ ၁၄ မှ ၂၆
ဒါဆိုရင် ကျွန်တော်တို့ဟာ solitaire ကို အသုံးပြုပြီး အက္ခရာတစ်လုံးကို ဘယ်လို ဖော်သလဲဆိုတာ သိလောက် ပါပြီ။ ကြိုက်သလောက် keystream စာလုံးအရေအတွက်ကို ဖန်တီးလို့ ရပါတယ်။

The Solitaire Encryption Algorithm

version 1.2, 5/26/99
Designed by Bruce Schneier
Featured in Neal Stephenson's Cryptonomicon

ဒီနည်းကို တီထွင်သူက တော့ Bruce Schneier ပါ။ Neal Stephenson ရဲ့ ၀တ္ထု Cryptonomicon မှာ ကုတ်နာမည် Pontifex ဟာ ဒီ ဖဲချပ်များက နေပြီး ၀ှက်စာဖေါ်တဲ့ နည်းကို ရည်ညွန်းတာပါ။ Solitaire မှာ အီလက်ထရောနစ် မပါဘဲနဲ့ ၀ှက်စာများကို ၀ှက်တာဖေါ်တာ တွေကို လုံခြုံစိတ်ချစွာ လုပ်ဆောင်နိုင်ပါတယ်။ Solitaire ဟာ ဖဲချပ်များရဲ့ randomly တည်ရှိနေမှု ဆိုတဲ့ security ကို ရယူထားပါတယ်။
ဒီနည်းမှာ key stream ဆိုတဲ့ ဂဏန်းအတန်း က အဓိကကျပါတယ် ။အဲဒါနဲ့ ပဲ အားလုံးကို ဖေါ်ရတာဖြစ်ပါ တယ်။ အဲဒီ key stream ကို ဖဲချပ်ထုတ်ထဲမှာ ဖွက်ထားပါတယ်။ Encrypt နဲ့ Decrypt ကို key stream သိမှပဲလုပ်လို့ရမှာ ဖြစ်ပါတယ်။ key stream ရဲ့ စာတန်းအရှည်က Encrypt လုပ်ထားတဲ့စာတန်းအရှည်နဲ့ အတူတူဖြစ်ရပါမယ်။

Encrypting with Solitaire
၁။ စာကြောင်းကနေပြီး punctuation တွေအားလုံးကိုဖြုတ်ပြီး character အားလုံးကို တစ်ပုံစံတည်း လုပ်ပါ။(ဆိုလိုတာက အားလုံးစာလုံးအကြီးအသေးမရှိ အတူတူပဲ)
၂။ character အားလုံးကို ဂဏန်းတန်ဖိုးကိုပြောင်းပါ။ A=1, B=2 ,C=3 ,etc (နောက်တွင် plaintext လို့ခေါ် ပါမည်)
၃။ Encrypt လုပ်ဖို့အတွက် plaintext က ဂဏန်းများကို key stream က ဂဏန်းတွေနဲ့ တစ်လုံးချင်း စီပေါင်း ပါ။ ပေါင်းရာမှာ ဂဏန်းတန်ဖိုးက ၂၆ (အင်္ဂလိပ်စာလုံးပေါင်း ၂၆ လုံးသာရှိသည်) ထက်ကျော်သွားရင် mod 26 ယူပေးပါ(26 နဲ့ စားပြီးအကြွင်းကိုယူပါ) အဲဒီ ဂဏန်းတန်းကတော့ Encrypt လုပ်ပြီးသားဖြစ်ပါတယ်။
ဥပမာ။ DO NOT USE PC ဆိုတဲ့ စာကြောင်း (plain text) ကို ၀ှက်မယ်ဆိုရင် အရင်ဆုံး ၅ လုံးစီပါတဲ့ group တစ်ခုစီကို လုပ်ပါ။ DONOT USEPC ဆိုတဲ့ ဟာရပါတယ်။နောက် key stream letter ကို KDWUP ONOWT လို့ထားပါ။ plain text ကို ဂဏန်းပြောင်းရင် (A=1, B=2, etc)
4 15 14 15 20 21 19 5 16 3
key stream letter ကိုပြောင်းရင်
11 4 23 21 16 15 14 15 23 20
ပြီးရင်အဲဒီနှစ်ကြောင်းကိုပေါင်းပါမယ်။ ဥပမာ။ 1+1=2, 26+1=1
15 19 11 10 10 10 7 20 13 23
ဒါကို စာကြောင်းပြန်ပြောင်းပါမယ်။
OSKJJ JGTMW

Decrypting with Solitaire
အပြန်အလှန်အနေနဲ့ receiver ကလည်း key stream ကို အရင်ထုတ်ရပါမယ်။Encrypt stream ကနေ အဲဒီ key stream ကို နှုတ်လိုက်ရင် မူရင်း stream ကို ရပါမယ်။
ဥပမာ။ ပေးထားတဲ့ ciphertext ကို ၅ လုံးစီ ပါတဲ့ group လေးတွေခွဲပါမယ်။
OSKJJ JGTMW
ပြီးရင် Solitaire ကိုအသုံးပြုပြီး key stream ကိုထုတ်ပါမယ်။အဲဒီ key stream က encrypt လုပ်တဲ့သူ အသုံးပြုခဲ့တဲ့ key stream နဲ့ တူရပါမယ်။
KDWUP ONOWT
ciphertext ကို ဂဏန်းတွေပြောင်းပါမယ်။
15 19 11 10 10 10 7 20 13 23
key stream ကိုပြောင်းပါမယ်။
11 4 23 21 16 15 14 15 23 20
အဲဒီနှစ်ခုကို နှုတ်ပါမယ်။ ဥပမာ။ 21-1=20, 1-22=5 ,etc)
4 15 14 15 20 21 19 5 16 3
စာကြောင်းပြောင်းပါ.
DONOT USEPC

My Blog Posts From MyanmarDate.com

Now here it is ... I collect my little posts (poems) from www.myanmardate.com

dock dock dock !!! House owner !!!
-Can i come in ??? My name is Dr.LOVE. i heard that something is happened in your heart...i can cure you ....Take my LOVE...

Loving to the innocent rabbit who give a lot of trouble to me
..but....because of this rabbit...
-can feel the lyric more than melody
-can feel the breeze more than wind
-can feel the romance more than humor
-can love blue color more than red color
-want to show happiness ,,and want to be not knowing any of sadness ...
Whatever happened to me ,,, i only read this book .."about you "..


the man who take a little piece of hope ==>"when will she love me ??? "
the man who take a little piece of jealous ===>"when she loves others , ???"
the man who take a little piece of kind ===> "when can i help her ???"
the man who take a little piece of forgiveness ===> "whatever her do ,, ???"
the man who take a little piece of knowledge ===> "only about you "


From my childhood,,i play ,,,i read,,, i eat,,,i sleep,,,are all about i do and i understand....but after seeing you ,,,,i really know "i am a human ". coz when i see you,,my heart beats fast .. i feel LOVE ..i touch LOVE...ohhh ...so strange ..."even cannot tell any words in front of you " ..so strong .."even can die in front of you "...IS IT LOVE ??? ...or IS HE A FOOL ???? crazy !
but i accept that life is not perfect if there isn't LOVE !!!

powered by Blogger