Mavzu: msdos operatsion tizimlarida operativ xotirani taqsimlash. Xotirani taqsimlash usullari (statik, dinamik). Kiritish-chiqarish tizimli jadvallar va ularning bog‘lanishi


Download 0.5 Mb.
bet5/7
Sana25.12.2022
Hajmi0.5 Mb.
#1065581
1   2   3   4   5   6   7
Bog'liq
8 OPERATSION TIZIMLAR 8-MUSTAQIL ISH Operatsion tizimlarda resurs tushunchasi. Resurslarni sinflashti

List * n q new List; // Yangi
element hosil qilish
n->prev q w; // 1 - amal
n->next q w->next; // 2 - amal
if (w->next) {w->next->prev q n;} // 3 - amal
w->next q n; // 4 - amal
n->Data q data; // funksional
elementni initsializatsiya qilish
Qo‘yish har doim so‘nggi elementdan bajarilganligi uchun w- >next ning qiymati har doim nol bo‘ladi, ya’ni 3-amal hech qachon bajarilmaydi, shuning uchun uni tushirib qoldirish mumkin. Dasturning asosiy kodida bu amal tushirib qoldirilgan.
Dastur kodi
#include
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
struct List
{
List* prev;
List* next;
AnsiString Data;
};
List* add(List* w, AnsiString data) // Ro‘yxatga element qo‘shish
{
List * n = new List;
n->prev = w;
n->next = w->next;
w->next = n;
n->Data = data;
return n;
}
List* del(List* w) // Ro‘yxatdan elementni o‘chirish
{
if(w->prev){w->prev->next = w->next;}
if(w->next){w->next->prev = w->prev;}
List * r;
if(w->next) {r = w->next;} else {r = w->prev;}
delete w;
return r;
}
List First; // Ro‘yxatning boshi
List* Last = &First; // Ro‘yxatning oxiri
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)

Download 0.5 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling