SlidePub
Home
Categories
Login
Register
Home
General
1.2 Kernel Data Structures.ppt
1.2 Kernel Data Structures.ppt
1,436 views
10 slides
Jan 10, 2024
Slide
1
of 10
Previous
Next
1
2
3
4
5
6
7
8
9
10
About This Presentation
os
Size:
377.92 KB
Language:
en
Added:
Jan 10, 2024
Slides:
10 pages
Slide Content
Slide 1
Kernel Data Structures
M.AKILA RANI
AP/IT
Slide 2
1.2 Kernel Data Structures
1.2.1 Lists, Stacks and Queues
1.2.2 Trees
1.2.3 Hash Functions and Maps
1.2.4 Bitmaps
Slide 3
1.2.1 Lists, Stacks and Queues
•Anarrayisasimpledatastructureinwhicheachelementcanbeaccesseddirectly.For
example,mainmemoryisconstructedasanarray.Ifthedataitembeingstoredislarger
thanonebyte,thenmultiplebytescanbeallocatedtotheitem,andtheitemisaddressed
as“itemnumber×itemsize.”
•Alistrepresentsacollectionofdatavaluesasasequence.Themostcommonmethodfor
implementingthisstructureisalinkedlist,inwhichitemsarelinkedtooneanother.
Linkedlistsareofseveraltypes:
1.Inasinglylinkedlist,eachitempointstoitssuccessor,asillustratedinFigure1.17.
2.Inadoublylinkedlist,agivenitemcanrefereithertoitspredecessorortoits
successor,asillustratedinFigure1.18.
3.Inacircularlylinkedlist,thelastelementinthelistreferstothefirstelement,rather
thantonull,asillustratedinFigure1.19.
Slide 5
•Linkedlistsaccommodateitemsofvaryingsizesandalloweasyinsertionanddeletion
ofitems.Onepotentialdisadvantageofusingalististhatperformanceforretrievinga
specifiediteminalistofsizenislinear—O(n),asitrequirespotentiallytraversingalln
elementsintheworstcase.
•Astackisasequentiallyordereddatastructurethatusesthelastin,firstout(LIFO)
principleforaddingandremovingitems,meaningthatthelastitemplacedontoastack
isthefirstitemremoved.Theoperationsforinsertingandremovingitemsfromastack
areknownaspushandpop,respectively.
•Aqueue,incontrast,isasequentiallyordereddatastructurethatusesthefirstin,first
out(FIFO)principle:itemsareremovedfromaqueueintheorderinwhichtheywere
inserted.
•Therearemanyeverydayexamplesofqueues,includingshopperswaitinginacheckout
lineatastoreandcarswaitinginlineatatrafficsignal.Queuesarealsoquitecommon
inoperatingsystems—jobsthataresenttoaprinteraretypicallyprintedintheorderin
whichtheyweresubmitted,forexample.
Slide 6
1.2.2 Trees
•Atreeisadatastructurethatcanbeusedtorepresentdatahierarchically.Datavaluesin
atreestructurearelinkedthroughparent–childrelationships.
•Inageneraltree,aparentmayhaveanunlimitednumberofchildren.Inabinarytree,a
parentmayhaveatmosttwochildren,whichwetermtheleftchildandtherightchild.
•Abinarysearchtreeadditionallyrequiresanorderingbetweentheparent’stwochildren
inwhichleftchild<=rightchild.Figure1.20providesanexampleofabinarysearch
tree.Whenwesearchforaniteminabinarysearchtree,theworst-caseperformanceis
O(n).
•Toremedythissituation,wecanuseanalgorithmtocreateabalancedbinarysearch
tree.Here,atreecontainingnitemshasatmostlgnlevels,thusensuringworst-case
performanceofO(lgn).
Slide 7
1.2.3 Hash Functions and Maps
•Ahashfunctiontakesdataasitsinput,performsanumericoperationonthedata,
andreturnsanumericvalue.
•Thisnumericvaluecanthenbeusedasanindexintoatable(typicallyanarray)to
quicklyretrievethedata.
•WhereassearchingforadataitemthroughalistofsizencanrequireuptoO(n)
comparisons,usingahashfunctionforretrievingdatafromatablecanbeasgoodas
O(1),dependingonimplementationdetails.Becauseofthisperformance,hash
functionsareusedextensivelyinoperatingsystems.
•Onepotentialdifficultywithhashfunctionsisthattwouniqueinputscanresultinthe
sameoutputvalue—thatis,theycanlinktothesametablelocation.Wecan
accommodatethishashcollisionbyhavingalinkedlistatthetablelocationthat
containsalloftheitemswiththesamehashvalue.
Slide 8
•Ofcourse,themorecollisionsthereare,thelessefficientthehashfunctionis.
Oneuseofahashfunctionistoimplementahashmap,whichassociates(or
maps)[key:value]pairsusingahashfunction.
•Oncethemappingisestablished,wecanapplythehashfunctiontothekeyto
obtainthevaluefromthehashmap(Figure1.21).
•Forexample,supposethatausernameismappedtoapassword.Password
authenticationthenproceedsasfollows:auserentersherusernameandpassword.
•Thehashfunctionisappliedtotheusername,whichisthenusedtoretrievethe
password.Theretrievedpasswordisthencomparedwiththepasswordenteredby
theuserforauthentication.
Slide 9
1.2.4 Bitmaps
•Abitmapisastringofnbinarydigitsthatcanbeusedtorepresentthestatusofn
items.
•Forexample,supposewehaveseveralresources,andtheavailabilityofeachresource
isindicatedbythevalueofabinarydigit:0meansthattheresourceisavailable,while
1indicatesthatitisunavailable(orviceversa).
•Thevalueoftheithpositioninthebitmapisassociatedwiththeithresource.Asan
example,considerthebitmapshownbelow:
001011101
Slide 10
•Resources2,4,5,6,and8areunavailable;resources0,1,3,and7areavailable.
•Bitmapsarecommonlyusedwhenthereisaneedtorepresenttheavailabilityofa
largenumberofresources.
•Amedium-sizeddiskdrivemightbedividedintoseveralthousandindividualunits,
calleddiskblocks.Abitmapcanbeusedtoindicatetheavailabilityofeachdisk
block.
LINUXKERNELDATASTRUCTURES
•Linuxdatastructuresdefinedinincludefiles<linux/list.h>,<linux/kfifo.h>,
<linux/rbtree.h>
Tags
Categories
General
Download
Download Slideshow
Get the original presentation file
Quick Actions
Embed
Share
Save
Print
Full
Report
Statistics
Views
1,436
Slides
10
Age
691 days
Related Slideshows
22
Pray For The Peace Of Jerusalem and You Will Prosper
RodolfoMoralesMarcuc
30 views
26
Don_t_Waste_Your_Life_God.....powerpoint
chalobrido8
32 views
31
VILLASUR_FACTORS_TO_CONSIDER_IN_PLATING_SALAD_10-13.pdf
JaiJai148317
30 views
14
Fertility awareness methods for women in the society
Isaiah47
29 views
35
Chapter 5 Arithmetic Functions Computer Organisation and Architecture
RitikSharma297999
26 views
5
syakira bhasa inggris (1) (1).pptx.......
ourcommunity56
28 views
View More in This Category
Embed Slideshow
Dimensions
Width (px)
Height (px)
Start Page
Which slide to start from (1-10)
Options
Auto-play slides
Show controls
Embed Code
Copy Code
Share Slideshow
Share on Social Media
Share on Facebook
Share on Twitter
Share on LinkedIn
Share via Email
Or copy link
Copy
Report Content
Reason for reporting
*
Select a reason...
Inappropriate content
Copyright violation
Spam or misleading
Offensive or hateful
Privacy violation
Other
Slide number
Leave blank if it applies to the entire slideshow
Additional details
*
Help us understand the problem better