shujuku第4章习题课

合集下载

shujuku第4章习题课

shujuku第4章习题课

第四章存储器管理1 .选择题1.存储保护的工作通常由 ___________ 实现。

A .软件 B .硬件 C .文件 D .硬件和软件配合 2 .段页式存储管理中,访问快表失败时,每访问一条指令或存取一个操作数都要 次访问主存。

A . 1 B . 2 C . 33. 在虚拟存储系统中,若进程在内存中占D . 4 3块(开始时为空)采用先进先出页面淘汰算法,当执行访问 __ 次缺页中断。

D . 10 页号序列为1、2、3、4、1、2、5、1、2、3、4、5、6时,将产生 A . 7 B . 8 C . 9 4.____________________________________________ 采用段页式存储管理,在 CPU 中应设置 ____________________________________ 寄存器。

A .段表和页表控制 B .段表控制 C .页表控制 5 .采用段页式存储管理时,内存地址分成段号、段内页号和页内地址三部分, A .但仍是线性 B .但仍是二维 C .故是三维 D .从而成为四维 6. 用户程序的逻辑地址可以不连续的存储管理方式是 ___________A .固定分区B .可变分区C .页式 7. 在可变分区分配方案中,为了实现主存的空间分配,采用 A .页表 B . 段表 C .段表+页表D .分区分配表+空闲区表8 .动态重定位是在 ________ 完成的。

A .作业执行前集中一次C .作业执行过程中D .界地址 ________ 地址。

D •段页 进行管理。

B .作业执行过程中集中一次 D •作业执行过程中由用户9.在以下的存储管理方案中,能扩充主存容量的是 _____________ 。

A .固定式分区分配 B .可变式分区分配 C .页式存储管理 D .分页虚拟存储管理 10 .在可变分区分配方案中,在空闲区表中以空闲区长度按递减顺序排列适合于 算法。

数据结构课后习题及解析第四章

数据结构课后习题及解析第四章

11. 写算法,实现顺序串的基本操作 StrReplace(&s,t,v)r1 中第 index 个字符起求出首次与串 r2 相同的子串的起始位置。

写一个函数将顺序串 s1 中的第 i 个字符到第 j 个字符之间的字符用 s2 串替换。

写算法,实现顺序串的基本操作 StrCompare(s,t) 。

第四章习题1. 设 s=' I AM A STUDENT , t= ' GOO D,q=' WORKER 给出下列操作的结果: StrLength(s); SubString(sub1,s,1,7);SubString(sub2,s,7,1);StrIndex(s, ' A ' ,4); StrReplace(s, ' STUDEN 'T,q); StrCat(StrCat(sub1,t), StrCat(sub2,q));2. 编写算法,实现串的基本操作 StrReplace(S,T,V) 。

3. 假设以块链结构表示串,块的大小为 1,且附设头结点。

试编写算法,实现串的下列基本操作:StrAsign(S,chars) ; StrCopy(S,T) ; StrCompare(S,T) ; StrLength(S) ; StrCat(S,T) ; SubString(Sub,S,pos,len) 。

4. 叙述以下每对术语的区别:空串和空格串;串变量和串常量;主串和子串;串变量的名字和串变 量的值。

5. 已知:S=”(xyz)* ” ,T= ”(x+z)*y ”。

试利用联接、求子串和置换等操作,将 S 转换为T. 6. S 和T 是用结点大小为1的单链表存储的两个串,设计一个算法将串 S 中首次与T 匹配的子串逆 置。

7. S 是用结点大小为4的单链表存储的串,分别编写算法在第k 个字符后插入串T ,及从第k 个字符 删除 len 个字符。

数据结构(第二版)习题答案第4章

数据结构(第二版)习题答案第4章
printf("input char to s2:\n");
gets(s2.str);
s2.length=strlen(s2.str);
m=strcompare(s1,s2);
if(m==1) printf("s1>s2\n");
else if(m==-1) printf("s2>s1\n");
free(S);
free(T1);
free(T2);
}
【参考程序
2】:
#include<stdio.h>
#define MAXSIZE 100
typedef struct{
char str[MAXSIZE];
int length;
}seqstring;
for(k=0;k<t2.length;k++)
s->str[c+k]=t2.str[k];
else if(t1.length<t2.length)
{ for(m=s->length-1;m>i-1;m--)
s->str[t2.length-t1.length+m]=s->str[m]; //后移留空
while (i<t->length && j<p->length)
{
if(j==-1||t->str[i]==p->str[j])
{i++; j++;}
else j=next[j];
}
if (j==p->length) return (i-p->length);

第4章 习题与参考答案20-35

第4章 习题与参考答案20-35

第4章 习题与参考答案【题4-1】 写出图题4-1的输出逻辑函数式。

图题4-1解:(1)C A A AC B A Y +=++=1(2)D B C B A CD B A CD B A D BD CD A B A Y ++=++=+=++=)(2 【题4-2】 使用与门、或门实现如下的逻辑函数式。

(1)1Y ABC D =+ (2)2Y A CD B =+() (3)3Y AB C =+ 解:&1≥AB C DY11≥&&A B C DY2&A B 1≥Y3C....【题4-3】 使用与门、或门和非门,或者与门、或门和非门的组合实现如下的逻辑函数式。

(1)1Y AB BC =+(2)2Y A C B =+() (3)3Y ABC B EF G =++()ABC.Y2A B C .E F G...【题4-4】试写出图题4-4所示电路的逻辑函数式,列出真值表,并分析该电路的逻辑功能。

图题4-4解:=1+ACBCABY+此电路是三人表决电路,只要有两个人输入1,输出就是1。

Y+CDABCDBA++⋅=⋅⋅=2BCDABCDCDDABCABBDCAABCDA该电路在4个输入中有3个为1时,输出Y2为1。

【题4-5】 逻辑电路与其输入端的波形如图题4-5所示,试画出逻辑电路输出端Y 的波形。

图题4-5解:B A Y +=BA.Y..【题4-6】 图题4-6所示的逻辑电路中,与非门为74LS00,或非门是74LS02,非门是74LS04。

试分析该电路的最大传输延迟时间。

图题4-6解:74LS00、74LS02和74LS04的最大t PHL 和t PLH 都是15ns ,因为A 信号经过4级门达到输出端X ,因此最大传输延迟时间为4×15ns=60ns 。

【题4-7】 图题4-7所示的是家用报警器装置,该装置具有6个开关,各开关动作如下:ALARM....图题4-7人工报警开关M ,该开关闭合时,报警信号ALARM=1,开始报警。

计算机组成原理第四章课后习题及答案_唐朔飞().doc

计算机组成原理第四章课后习题及答案_唐朔飞().doc

第4 章存储器1.解释概念:主存、辅存、Cache RAM SRAM DRAMROMPROMEPROVEEPROM CDRO、MFlash Memory 。

答:主存:主存储器,用于存放正在执行的程序和数据。

CPU可以直接进行随机读写,访问速度较高。

辅存:辅助存储器,用于存放当前暂不执行的程序和数据,以及一些需要永久保存的信息。

Cache:高速缓冲存储器,介于CPU和主存之间,用于解决CPU和主存之间速度不匹配问题。

RAM半导体随机存取存储器,主要用作计算机中的主存。

SRAM 静态半导体随机存取存储器。

DRAM 动态半导体随机存取存储器。

ROM 掩膜式半导体只读存储器。

由芯片制造商在制造时写入内容,以后只能读出而不能写入。

PROM 可编程只读存储器,由用户根据需要确定写入内容,只能写入一次。

EPRO M紫外线擦写可编程只读存储器。

需要修改内容时,现将其全部内容擦除,然后再编程。

擦除依靠紫外线使浮动栅极上的电荷泄露而实现。

EEPROM电擦写可编程只读存储器。

CDROMI只读型光盘。

Flash Memory :闪速存储器。

或称快擦型存储器。

2.计算机中哪些部件可以用于存储信息?按速度、容量和价格/ 位排序说明。

答:计算机中寄存器、Cache主存、硬盘可以用于存储信息。

按速度由高至低排序为:寄存器、Cache主存、硬盘;按容量由小至大排序为:寄存器、Cache主存、硬盘;按价格/位由高至低排序为:寄存器、Cache主存、硬盘3.存储器的层次结构主要体现在什么地方?为什么要分这些层次?计算机如何管理这些层次?答:存储器的层次结构主要体现在Cache-主存和主存-辅存这两个存储层次上。

Cache-主存层次在存储系统中主要对CPU访存起加速作用,即从整体运行的效果分析,CPU访存速度加快,接近于Cache的速度,而寻址空间和位价却接近于主存。

主存-辅存层次在存储系统中主要起扩容作用,即从程序员的角度看,他所使用的存储器其容量和位价接近于辅存,而速度接近于主存。

数据结构课后习题与解析第四章

数据结构课后习题与解析第四章

第四章习题1. 设s=’I AM A STUDENT’, t=’GOOD’, q=’WORKER’。

给出下列操作的结果:StrLength(s); SubString(sub1,s,1,7); SubString(sub2,s,7,1);StrIndex(s,’A’,4); StrReplace(s,’STUDENT’,q);StrCat(StrCat(sub1,t), StrCat(sub2,q));2. 编写算法,实现串的基本操作StrReplace(S,T,V)。

3. 假设以块链结构表示串,块的大小为1,且附设头结点。

试编写算法,实现串的下列基本操作:StrAsign(S,chars);StrCopy(S,T);StrCompare(S,T);StrLength(S);StrCat(S,T);SubString(Sub,S,pos,len)。

4.叙述以下每对术语的区别:空串和空格串;串变量和串常量;主串和子串;串变量的名字和串变量的值。

5.已知:S=”(xyz)*”,T=”(x+z)*y”。

试利用联接、求子串和置换等操作,将S转换为T. 6.S和T是用结点大小为1的单链表存储的两个串,设计一个算法将串S中首次与T匹配的子串逆置。

7.S是用结点大小为4的单链表存储的串,分别编写算法在第k个字符后插入串T,及从第k个字符删除len个字符。

以下算法用定长顺序串:8.编写下列算法:(1)将顺序串r中所有值为ch1的字符换成ch2的字符。

(2)将顺序串r中所有字符按照相反的次序仍存放在r中。

(3)从顺序串r中删除其值等于ch的所有字符。

(4)从顺序串r1中第index 个字符起求出首次与串r2相同的子串的起始位置。

(5)从顺序串r中删除所有与串r1相同的子串。

9.写一个函数将顺序串s1中的第i个字符到第j个字符之间的字符用s2串替换。

10.写算法,实现顺序串的基本操作StrCompare(s,t)。

数据结构第4单元课后练习答案

数据结构第4单元课后练习答案
第四单元 树形结构
对于三个结点A,B和C,可分别组成多少 不同的无序树、有序树和二叉树?
答:(1)无序树:9棵 (2)有序树:12棵 (3)二叉树:30棵
高度为h的k叉树的特点是:第h层的节点度为 0,其余结点的度均为k。如果按从上到下, 从左到右的次序从1开始编号,则: ①各层的结点是多少? ②编号为i的结点的双亲的编号是多少? ③编号为i的结点的第m个孩子的编号是多少? ④编号为i的结点的有右兄弟的条件是什么?
试证明在哈夫曼算法的实施过程中,二叉树森林中的每 一棵子树都是Huffman树。
证明: 在Huffman算法进行的每一步,都会有一棵新的二叉树产生,它是合并 原来森林中根结点权值最小的两棵子树而得来的。假设此二叉树为T。 取T的根为一棵独立的子树,则它是一棵Huffman树,将此结点向下分 解,仍然得到一棵Huffman树。 此后,按照与T的形成过程相反的顺序依次分解各叶结点。由于在每次 分解时,新产生的两个叶结点在Huffman算法过程中,都是待合并子树根 结点中权值最小的,也就必然在本二叉树中是权值最小的两个叶结点。 根据前面的定理可知,T是一棵Huffman树。
试证明哈夫曼算法的正确性。
定理 分裂一棵Huffman树的某个叶结点,如果产生的两个叶结点的权值 在所有叶结点权值中最小,则将生成一棵新的Huffman树。 证明: 假设二叉树T是字母表C上的一棵Huffman树,z是它的一个叶节点。在 z的下面添加两个子结点x和y,它们的权值分别是f(x)和f(y),且满足 f(z)=f(x)+f(y), f(x)和f(y)在字母表C' =C-{z}+{x,y}上的权值最小,可设新 产生的二叉树为T'。 在字母表C'上存在一棵最优二叉树T",在T"上x和y互为兄弟结点。在 T"中删除结点x和y,将字母z以及权值f(z)=f(x)+f(y)赋予x和y在T"中的父 结点,得到一棵在字母表C上的二叉树Ť。 根据引理三,可知Ť是字母表C上的最优二叉树,由于T也是字母表C上 的最优二叉树,所以WPL(Ť)= WPL(T)。 由于WPL(Ť)= WPL(T")-f(x)-f(y), WPL(T)= WPL(T')-f(x)-f(y),所以 WPL(T")=WPL(T'),即,T'是字母表C'上的最优二叉树。证毕。 补充说明:利用Huffman算法构造一棵二叉树T后,单独取出根结点和它 的两个子结点,则该子树必是一棵最优二叉树。以后,按照与T的形成过 程的相反的顺序依次分解各叶结点,直到再次构造出T,则依据上面的定 理可知T是一棵Huffman树。

数据库系统基础教程第四章答案(完整资料).doc

数据库系统基础教程第四章答案(完整资料).doc

【最新整理,下载后即可编辑】SolutionsChapter 4 4.1.14.1.2a)b)c)In c we assume that a phone and address can only belong to a single customer (1-m relationship represented by arrow into customer).d)In d we assume that an address can only belong to one customer and a phone can exist at only one address.If the multiplicity of above relationships were m-to-n, the entity set becomes weak and the key ssNo of customers will be needed as part of the composite key of the entity set.In c&d, we convert attributes phones and addresses to entity sets. Since entity sets often become relations in relational design,we must consider more efficient alternatives.Instead of querying multiple tables where key values are duplicated, we can also modify attributes:(i) Phones attribute can be converted into HomePhone, OfficePhone and CellPhone.(ii) A multivalued attribute such as alias can be kept as an attribute where a single column can be used in relational design i.e. concatenate all values. SQL allows a query "like '%Junius%'" to search the multiple values in a column alias.4.1.34.1.4a)b)c)The relationship "played" between Teams and Players is similar to relationship "plays" between Teams and Players.4.1.54.1.6 The information about children can be ascertained from motherOf and fatherOf relationships. Attribute ssNo is required since names are not unique.4.1.74.1.8a)(b)4.1.9AssumptionsA Professor only works in at most one department.A course has at most one TA.A course is only taught by one professor and offered by one department. Students and professors have been assigned unique email ids.A course is uniquely identified by the course no, section no, and semester (e.g. cs157-3 spring 09).4.1.10Given that for each movie, a unique studio exists that produces the movie. Each star is contracted to at most one studio.But stars could be unemployed at a given time. Thus the four-way relationship in fig 4.6 can be easily into converted equivalent relationships.4.2.1Redundancy: The owner address is repeated in AccSets and Addresses entity sets. Simplicity: AccSets does not serve any useful purpose and the design can be more simply represented by creating many-to-many relationship between Customers and Accounts.Right kind of element: The entity set Addresses has a single attribute address. A customer cannot have more than one address.Hence address should be an attribute of entity set Customers. Faithfulness: Customers cannot be uniquely identified by their names. In real world Customers would have a unique attribute such as ssNo or customerNo 4.2.2Studios and Presidents can be combined into one entity set Studios with Presidents becoming an attribute of Studios under following circumstances:1. The Presidents entity set only contains a simple attribute viz. presidentName. Additional attributes specific to Presidents might justify making Presidents into an entity set.4.2.34.2.4 The entity sets should have single attribute.a) Stars: starNameb) Movies: movieNamec) Studios: studioName. However there exists a many-to-many relationship between Studios and Contracts. Hence, in addition, we need more informationabout studios involved. If a contract always involves two studios, two attributes such as producingStudio and starStudio can replace theStudios entity set. If a contact can be associated with at most five studios, it may be possible to replace the Studios entity set by five attributes viz. studio1, studio2, studio3, studio4, and studio5. Alternately, a composite attribute containing concatenation of all studio names in a contact can be considered. A separator character such as "$" can be used. SQL allows searching of such an attribute using query like '%keyword%'4.2.5From Augmentation rule of Functional Dependency,givenB -> M (B=Baby, M=Mother)thenBND -> M (N=Nurse, D=Doctor)Hence we can just put an arrow entering mother.a) Put an arrow entering entity set Mothers for the simplest solution (As in fig. 4.4, where a multi-way relationship was allowed, even though Movies alone could identify the Studio). However, we can display more accurate information with below figure.b)c)Again from Augmentation rule of Functional Dependency, givenBM -> DthenBMN -> DThus we can just add an arrow entering Doctors to fig 4.15. Below figure represents more accurate information however.4.2.6a)b) Transitivity and Augmentation rules of Functional Dependency allow arrow entering Mothers from Births. However, a new relationship in below figure represents more accurate information.c)Design flaws in abc above 1. As suggested above, using Transitivity and Augmentation rules of Functional Dependency, much simpler design is possible.4.2.7In below figure there exists a many-to-one relationship between Babies and Births and another many-to-one relationship between Births and Mothers. From transitivity of relationships, there is a many-to-one relationship between Babiesand Mothers. Hence a baby has a unique mother while a birth can allow more than one baby.4.3.1a)b)A captain cannot exist without a team. However a player can (free agent). A recently formed (or defunct) team can exist without players or colors.c)Children can exist without mother and father (unknown).4.3.2a)The keys of both E1 and E2 are required for uniquely identifying tuples in R b)The key of E1c)The key of E2d)The key of either E1 or E24.3.3Special Case: All entity sets have arrows going into them i.e. all relationships are 1-to-1Any KiOtherwise: Combination of all Ki's where there does not exist an arrow going from R to Ei.4.4.1No, grade is not part of the key for enrollments. The keys of Students and Courses become keys of the weak entity set Enrollments.4.4.2It is possible to make assignment number a weak key of Enrollments but this is not good design (redundancy since multiple assignments correspond to a course).A new entity set Assignment is created and it is also a weak entity set. Hence the key attributes of Assignment will come from the strong entity sets to which Enrollments is connected i.e. studentID, dept, and CourseNo.4.4.3a)b)c)4.4.4a)b)4.5.1Customers(SSNo,name,addr,phone)Flights(number,day,aircraft)Bookings(custSSNo,flightNo,flightDay,row,seat)Relations for toCust and toFlt relationships are not required since the weak entity set Bookings already contains the keys of Customers and Flights.4.5.2(a)(b)Schema is changed. Since toCust is no longer an identifying relationship, SSNo is no longer a part of Bookings relation.Bookings(flightNo,flightDay,row,seat)ToCust(custSSNO,flightNo,flightDay,row,seat)The above relations are merged intoBookings(flightNo,flightDay,row,seat,custSSNo)However custSSNo is no longer a key of Bookings relation. It becomes a foreign key instead.4.5.3Ships(name, yearLaunched)SisterOf(name, sisterName)4.5.4(a)Stars(name,addr)Studios(name,addr)Movies(title,year,length,genre)Contracts(starName,movieTitle,movieYear,studioName,salary)Depending on other relationships not shown in ER diagram, studioName may not be required as a key of Contracts (or not even required as an attribute of Contracts).(b)Students(studentID)Courses(dept,courseNo)Enrollments(studentID,dept,courseNo,grade)(c)Departments(name)Courses(deptName,number)(d)Leagues(name)Teams(leagueName,teamName)Players(leagueName,teamName,playerName)4.6.1The weak relation Courses has the key from Depts along with number. Hence there is no relation for GivenBy relationship.(a)Depts(name, chair)Courses(number, deptName, room)LabCourses(number, deptName, allocation)(b) LabCourses has all the attributes of Courses.Depts(name, chair)Courses(number, deptName, room)LabCourses(number, deptName, room, allocation)(c) Courses and LabCourses are combined into one relation.Depts(name, chair)Courses(number, deptName, room, allocation)4.6.2(a)Person(name,address)ChildOf(personName,personAddress,childName,childAddress)Child(name,address,fatherName,fatherAddress,motherName,motherAddresss) Father(name,address,wifeName,wifeAddresss)Mother(name,address)Since FatherOf and MotherOf are many-one relationships from Child, there is no need for a separate relation for them. Similarly the one-one relationship Married can be included in Father (or Mother). ChildOf is a many-many relationship and needs a separate relation.However the ChildOf relation is not required since the relationship can be deduced from FatherOf and MotherOf relationships contained in Child relation.(b)A person cannot be both Mother and Father.Person(name,address)PersonChild(name,address)PersonChildFather(name,address)PersonChildMother(name,address)PersonFather(name,address)PersonMother(name,address)ChildOf(personName,personAddress,childName,childAddress)FatherOf(childName,childAddress,fatherName,fatherAddress)MotherOf(childName,childAddress,motherName,motherAddress)Married(husbandName,husbandAddress,wifeName,wifeAddress)The many-many ChildOf relationship again requires a relation.An entity belongs to one and only one class when using object-oriented approach. Hence, the many-one relations MotherOf and FatherOf could be added as attributes to PersonChild,PersonChildFather, and PersonChildMother relations.Similarly the Married relation can be added as attributes to PersonChildMother and PersonMother (or the corresponding father relations).(c) For the Person relation at least one of husband and wife attributes will be null. Person(personName,personAddress,fatherName,fatherAddress,motherName,mot herAddresss,wifeName,wifeAddresss,husbandName,husbandAddress) ChildOf(personName,personAddress,childName,childAddress)4.6.3(a)People(name,fatherName,motherName)Males(name)Females(name)Fathers(name)Mothers(name)ChildOf(personName,childName)(b)People(name)PeopleMale(name)PeopleMaleFathers(name)PeopleFemale(name)PeopleFemaleMothers(name)ChildOf(personName,childName)FatherOf(childName,fatherName)MotherOf(childName,motherName)People cannot belong to both male and female branch of the ER diagram. Moreover since an entity belongs to one and only one class when using object-oriented approach, no entity belongs to People relation.Again we could replace MotherOf and FatherOf relations by adding as attributes to PeopleMale,PeopleMaleFathers,PeopleFemale, and PeopleFemaleMothers relations.(c)People(name,fatherName,motherName)ChildOf(personName,childName)4.6.4(a)Each entity set results in one relation. Thus both the minimum and maximum number of relations is e.The root relation has a attributes including k keys. Thus the minimum number of attributes is a. All other relations include the k keys from root along with their a attributes. Thus the maximum number of attributes is a+k.(b)The relation for root will have a attributes. The relation representing the whole tree will have e*a attributes.The number of relations will depend on the shape of the tree. A tree of e entities where only one child exists(say left child only) would have the minimum number of relations. Thus below figure will only contain 4 subtrees that contain rootE1,E1E2,E1E2E3, and E1E2E3E4. With e entity sets, minimum e relations are possible.The maximum number of subtrees result when all the entities(except root) are at depth 1. Thus below figure will contain 8 subtrees that contain rootE1,E1E2,E1E3,E1E4,E1E2E3,E1E3E4,E1E2E4,and E1E2E3E4. With e entity sets, maximum 2^(e-1) relations are possible.The nulls method always results in one relation and contains attributes from all e entities i.e. e*a attributes.Summarizing for a,b, and c above;#Components #RelationsMin Max Min MaxMethodstraight-E/R a a e eobject-oriented a e*a e 2^(e-1)nulls e*a e*a 1 14.7.14.7.2a)b)c)d)4.7.34.7.44.7.5Males and Females subclasses are complete. Mothers and Fathers are partial. All subclasses are disjoint.4.7.6。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

第四章存储器管理1.选择题1.存储保护的工作通常由实现。

A.软件B.硬件C.文件D.硬件和软件配合2.段页式存储管理中,访问快表失败时,每访问一条指令或存取一个操作数都要次访问主存。

A.1 B.2 C.3 D.43.在虚拟存储系统中,若进程在内存中占3块(开始时为空)采用先进先出页面淘汰算法,当执行访问页号序列为1、2、3、4、1、2、5、1、2、3、4、5、6时,将产生次缺页中断。

A.7 B.8 C.9 D.104.采用段页式存储管理,在CPU中应设置寄存器。

A.段表和页表控制B.段表控制C.页表控制D.界地址5.采用段页式存储管理时,内存地址分成段号、段内页号和页内地址三部分,地址。

A.但仍是线性B.但仍是二维C.故是三维D.从而成为四维6.用户程序的逻辑地址可以不连续的存储管理方式是。

A.固定分区B.可变分区C.页式D.段页7.在可变分区分配方案中,为了实现主存的空间分配,采用进行管理。

A.页表B.段表C.段表+页表D.分区分配表+空闲区表8.动态重定位是在完成的。

A.作业执行前集中一次B.作业执行过程中集中一次C.作业执行过程中D.作业执行过程中由用户9.在以下的存储管理方案中,能扩充主存容量的是。

A.固定式分区分配B.可变式分区分配C.页式存储管理D.分页虚拟存储管理10.在可变分区分配方案中,在空闲区表中以空闲区长度按递减顺序排列适合于________算法。

A.最坏适应算法B.最先适应算法C.最优适应算法D.首次循环适应算法11.在页式虚拟存储管理中,为实现地址变换,应建立。

A.空闲区表B.分区分配表C.页表D.段表12.在下述存储管理方案中,管理方式要求作业的逻辑地址与占有主存的存储区域都是连续的。

A.段页式B.页式C.段式D.可变分区13.将主存空闲区按地址顺序从小到大登记在空闲区表中,每次分配时总是顺序查找空闲区表,此种分配算法称为分配算法。

A.最先适应B.最优适应C.最坏适应D.随机适应14.页式存储管理中,每次从主存中取指令或取操作数,当读快表失败时,要读次主存。

A.1 B.2 C.3 D.415.段式和页式存储管理的地址结构很类似,但是它们之间有实质上的不同。

以下说法中,错误的是。

A.页式的逻辑地址是连续的,段式的逻辑地址可以不连续B.页式的地址是一维的,段式的地址是二维的C.分页是操作系统进行的,分段是用户确定的D.页式采用动态重定位方式,段式采用静态重定位方式16.主存的地址空间常称为。

A.逻辑地址空间B.程序地址空间C.物理地址空间D.相对地址空间17.在可变分区存储管理中,最优适应分配算法要求对空闲区表项按进行排列。

A.地址从大到小B.地址从小到大C.尺寸从大到小D.尺寸从小到大18.在请求页式存储管理中,当查找的页不在中时,要产生缺页中断。

A.外存B.虚存C.内存D.地址空间19.在段页式系统中(无快表),为获得一条指令或数据,必须访问内存。

A.1次B.2次C.3次D.4次20.在段式存储管理的地址转换时,若段内地址大于段表中该段的长度,则发生。

A.缺页中断B.溢出中断C.硬件故障中断D.地址越界中断21.在下列存储管理方式中,不要求将作业全部装入并不要求一个连续存储空间的管理方式是。

A.固定分区存储管理B.可变分区存储管理C.页式存储管理D.请求页式存储管理22.在段式存储管理中,。

A.以段为单位分配,每一段是一个连续存储区B.段与段之间必定不连续C.段与段之间必定连续D.每段是等长的23.页式虚拟存储管理中,当访问的页不在时,产生缺页中断。

A.内存B.外存C.虚存D.缓存24.在虚拟存储的实现中,需要页面淘汰的原因是。

A.产生缺页中断时内存中没有空闲块B.内存空间太大C.页面换出、换入太频繁D.进程要被封锁25.把目标程序中的逻辑地址转换成主存空间的物理地址称为。

A.存储分配B.地址重定位C.地址保护D.程序移动26.在操作系统的存储管理中,页式分配(分页)是。

A.把程序的逻辑空间和内存的物理空间按同样的尺寸分成若干页B.把作业按其所需空间分成若干页C.将内存的空闲空间分成若干页D.随机地将每个作业的地址空间分成大小相同的若干页27.在系统运行时,对于固定分区的存储管理方式,内存中能并发执行的作业的最大数量是_ 。

A.用户确定的B.可变的C.不受限制的D.固定的28.在以下的存储管理方案中,允许动态扩充主存容量的是方式。

A.固定分区分配B.可变分区分配C.页式存储管理D.请求分页存储管理29.内存分配的最佳适应算法的空闲区表是。

A.按大小递减顺序排列B.按大小递增顺序排列C.按地址由小到大排列D.按地址由大到小排列30.很好地解决了“零头”(碎片)问题的存储管理方法是。

A.页式存储管理B.段式存储管理C.可变分区存储管理D.可重定位分区存储管理31.进程在执行中发生了缺页中断,经操作系统处理后,应让其执行指令。

A.被中断的前一条B.被中断的C.被中断的后一条D.启动时的第一条指令32.虚拟存储管理系统的理论基础是程序的原理。

A.局部性B.全局性C.动态性D.虚拟性33.在操作系统中,是以时间换取空间的技术。

A.假脱机技术B.虚拟存储器C.中断技术D.通道技术34.操作系统中,具有虚拟存储管理功能的管理方法包括存储管理。

A.动态分区B.分页式C.请求分段D.段页式35.假设某计算机系统的内存大小为2560KB,采用可变分区管理内存,在某一时刻内存的使用情况如下表所示:存,分配后的内存使用情况如下表所示:则该系统采用的内存分配算法是适应算法。

A.首次B.循环首次C.最佳D.最坏36.某动态分区分配存储管理系统,系统刚把始址为230K的的一小块内存分配出去后,内存中的空闲分区情况如下表所示:有一个作业申请50KB内存,系统把第2个空闲区分配给了该作业50KB,则该系统采用的分区分配算法是适应算法。

A.首次B.最佳C.循环首次D.最坏37.下列选项中,对分段存储管理叙述正确的是。

A.每个段必须是大小相等的B.每一段必须是连续的存储区C.每一段不必是连续的存储区D.段之间的存储区必须是连续的38.分区分配内存管理方式的主要保护措施是__________。

A.界地址保护B.程序代码保护C.数据保护D.栈保护39.在缺页处理过程中,操作系统执行的操作可能是。

Ⅰ.修改页表Ⅱ.磁盘I/O Ⅲ.分配页框A.仅Ⅰ、ⅡB.仅ⅡC.仅ⅢD.Ⅰ、Ⅱ和Ⅲ40.当系统发生抖动(thrashing)时,可以采取的有效措施是。

Ⅰ.撤销部分进程Ⅱ.增加磁盘交换区的容量Ⅲ.提高用户进程的优先级A.仅ⅠB.仅ⅡC.仅ⅢD.仅Ⅰ、Ⅱ41.在虚拟内存管理中,地址变换机构将逻辑地址变换为物理地址,形成该逻辑地址的阶段是________。

A.编辑B.编译C.连接D.装载42.下列关于虚拟存储器的叙述中,正确的是。

A.虚拟存储器只能基于连续分配技术B.虚拟存储器只能基于非连续分配技术C.虚拟存储器容量只受外存容量的限制D.虚拟存储器容量只受内存容量的限制2.应用题1.请求分页系统中,设某进程共有9个页,分配给该进程的主存块数为5,进程运行时,实际访问页面的次序是0,1,2,3,4,5,0,2,1,8,5,2,7,6,0,1,2。

试求:(1) FIFO页面调度算法,列出其页面淘汰次序和缺页中断次数,以及最后留驻主存的页号顺序。

(2) LRU页面调度算法,列出其页面淘汰次序和缺页中断次数,以及最后留驻主存的页号顺序。

(3) OPT页面调度算法,列出其页面淘汰次序和缺页中断次数,以及最后留驻主存的页号顺序。

2.某操作系统采用可变分区分配存储管理方法,用户区大小为512K,始址为0,用空闲分区表管理空闲分区。

若分配时采用分配空闲低地址部分的方案,其初始时用户区的512K空间空闲,对下述申请序列:申请300K,申请100K,释放300K,申请150K,申请30K,申请40K,申请60K,释放30K;回答下列问题:(1)采用首次适应算法,上述分配、释放操作完毕后,空闲分区中有哪些空闲块(给出始址,大小)?(2)采用最佳适应算法,上述分配、释放操作完毕后,空闲分区中有哪些空闲块(给出始址,大小)?3.考虑一个大小为460字的程序的下述内存访问序列:10 19 154 170 54 334 185 245 247 456 458 378(1)假定页面大小为100字,试给出页访问串;(2)假定内存中有200个字可供程序使用若采用FIFO算法,那么有关该访问串的缺页中断次数是多少?若使用LRU算法,则有关该访问串的缺页中断次数是多少?4.某系统对主存采用页式管理,供用户使用的内存区域共640K字节,被分成160块,块号为0,1,…,159。

现有一作业的地址空间共占4页,其页号为0, 1, 2, 3,被分配到主存的第2,4,1,5块中。

请回答:(1) 作业每一页的长度为多少字节?(2) 写出该作业被装入主存时,其对应的页表。

(3) 把该作业的每一页在主存中的起始地址(用16进制表示)填在下表中:5.在采用页式存储管理的系统中,某作业的逻辑地址空间为4页(每页2048字节),且已知该作业的页表如下表。

画出页式存储管理系统地址转换示意图,求出逻辑地址4688所对应的物理地址。

页表6.有一矩阵int a[100][100];该矩阵按先行后列次序存储。

在一个页式虚拟存储系统中,采用LRU 页面淘汰算法,设给该进程分配3个内存块(也称页框),每页可以存放200个整数。

其中第1个页框存放程序,且假定程序已经在内存。

程序A : for (i=0;i<100;i++) for (j=0;j<100;j++) a[i][j]=0; 程序B : for (j=0;j<100;j++)for (i=0;i<100;i++)a[i][j]=0;分别就程序A 和程序B 的执行过程计算缺页次数。

7.某系统采用段页式存储管理,其逻辑地址结构和某作业的段表、页表结构如下图所示。

请计算该作业中逻辑地址135468对应的物理地址(用十进制表示)。

8.一个32位地址的计算机系统使用二级页表,虚地址分为10位顶级页表,10位二级页表,其余是页内偏移。

试问:(1) 页面长度是多少?(2) 虚拟地址空间有多少个页面?9.某计算机有cache 、内存、辅存来实现虚拟存储器。

如果数据在cache ,访问它需要10ns ;如果在内存单不在cache ,需要60ns 将其装入缓存,然后才能访问;如果不在内存而在辅存,需要5ms 将其装入内存,再用60ns 将其装入cache ,然后才能访问。

假设cache 命中率是0.9,内存命中率为0.8(钱注:指cache 未命中时,即余下的10%中内存的命中率为80%),则数据平均访问时间是多少(ns)?10.如果一条指令执行时间是1μs ,发生一次缺页需要的处理时间为X μs ,若缺页率为平均每Y 条指令发生一次,则指令平均执行时间W 是多少?11.一个分页存储器的页表存放在内存。

相关文档
最新文档