假设磁盘块与缓冲区大小相同,每个盘块读入缓冲区的时间为15μs,由缓冲区送至用户区的时间是5μs,在用户区内系统对每块数据的处理时间为1μs。若用户需要将大小为10个磁盘块的Doc1文件逐块从磁盘读入缓冲区,并送至用户区进行处理,那么采用单缓冲区需要花费的时间为______μs;采用双缓冲区需要花费的时间为(请作答此空)μs。
- A.150
- B.151
- C.156
- D.201
正确答案及解析
正确答案
解析
因为在块设备输入时,假定从磁盘把一块数据输入到缓冲区的时间为T,缓冲区中的数据传送到用户工作区的时间为M,而系统处理(计算)的时间为C,如下图所示。

单缓冲工作过程图当第一块数据送入用户工作区后,缓冲区是空闲的可以传送第二块数据。这样第一块数据的处理C1与第二块数据的输入T2是可以并行的,依次类推,如下图所示。系统对每一块数据的处理时间为:Max(C, T)+M。因为,当T>C时,处理时间为M+T;当Timage.pngC时,处理时间为M+C。本题每一块数据的处理时间为15+5=20,Doc1文件的处理时间为20×10+1。

单缓冲并行工作示意图双缓冲工作方式基本方法是在设备输入时,先将数据输入到缓冲区1,装满后便转向缓冲区2。此时系统可以从缓冲区1中提取数据传送到用户区,最后由系统对数据进行处理,如下图所示。

双缓冲工作过程图双缓冲可以实现对缓冲区中数据的输入T和提取M,与CPU的计算C,三者并行工作,如下图所示。从图中可以看出,双缓冲进一步加快了I/O的速度,提高了设备的利用率。在双缓冲时,系统处理一块数据的时间可以粗略地认为是Max(C, T)。如果Cimage.pngT,可使块设备连续输入;如果C>T,则可使系统不必等待设备输入。本题每一块数据的处理时间为10,采用双缓冲需要花费的时间为15×10+5+1=156。

双缓冲并行工作示意图
包含此试题的试卷
你可能感兴趣的试题
The Internet of( 1)(IoT) describes physical objects that are embedded with Sensor,processing abilities,softwares,and other technologies that connect with other devices and systems over the ( 2) or other communication and exchange data networks .Over the past few years, IoT has become one of the most important technologies of the ( 3 ) centuryWe can connect objects to the Internet via embedded devices. By means of( 4) computing, the cloud, big data, and mobile technologies, physical things can share and collect data with minimal human intervention. Traditional fields of embedded systems,wireless ( 5) networks (WSNs),control systems,automation, independently and collectively enable IoT.回答5处
-
- A.sensor
- B.searching
- C.service
- D.source
- 查看答案
The Internet of( 1)(IoT) describes physical objects that are embedded with Sensor,processing abilities,softwares,and other technologies that connect with other devices and systems over the ( 2) or other communication and exchange data networks .Over the past few years, IoT has become one of the most important technologies of the ( 3 ) centuryWe can connect objects to the Internet via embedded devices. By means of( 4) computing, the cloud, big data, and mobile technologies, physical things can share and collect data with minimal human intervention. Traditional fields of embedded systems,wireless ( 5) networks (WSNs),control systems,automation, independently and collectively enable IoT.回答4处
-
- A.low-level
- B.low-cost
- C.high-cost
- D.high-performance
- 查看答案
The Internet of( 1)(IoT) describes physical objects that are embedded with Sensor,processing abilities,softwares,and other technologies that connect with other devices and systems over the ( 2) or other communication and exchange data networks .Over the past few years, IoT has become one of the most important technologies of the ( 3 ) centuryWe can connect objects to the Internet via embedded devices. By means of( 4) computing, the cloud, big data, and mobile technologies, physical things can share and collect data with minimal human intervention. Traditional fields of embedded systems,wireless ( 5) networks (WSNs),control systems,automation, independently and collectively enable IoT.回答3处
-
- A.19th
- B.20th
- C.21th
- D.22th
- 查看答案
The Internet of( 1)(IoT) describes physical objects that are embedded with Sensor,processing abilities,softwares,and other technologies that connect with other devices and systems over the ( 2) or other communication and exchange data networks .Over the past few years, IoT has become one of the most important technologies of the ( 3 ) centuryWe can connect objects to the Internet via embedded devices. By means of( 4) computing, the cloud, big data, and mobile technologies, physical things can share and collect data with minimal human intervention. Traditional fields of embedded systems,wireless ( 5) networks (WSNs),control systems,automation, independently and collectively enable IoT.回答2处
-
- A.path
- B.Internet
- C.route
- D.switch
- 查看答案
The Internet of( 1)(IoT) describes physical objects that are embedded with Sensor,processing abilities,softwares,and other technologies that connect with other devices and systems over the ( 2) or other communication and exchange data networks .Over the past few years, IoT has become one of the most important technologies of the ( 3 ) centuryWe can connect objects to the Internet via embedded devices. By means of( 4) computing, the cloud, big data, and mobile technologies, physical things can share and collect data with minimal human intervention. Traditional fields of embedded systems,wireless ( 5) networks (WSNs),control systems,automation, independently and collectively enable IoT.回答1处
-
- A.this
- B.thing
- C.think
- D.things
- 查看答案