登录
首页 » 操作系统 » 用信号量来实现读者-写者问题

用信号量来实现读者-写者问题

于 2022-08-21 发布 文件大小:15.49 kB
0 138
下载积分: 2 下载次数: 1

代码说明:

调试程序使其在读者优先模式下可以运行并且能实现基本的功能得出正确的结果:能够实现读写互斥,写写互斥,读读不互斥,一个进程结束能够唤醒等待队列中的进程(先读者队列后写着队列)完善功能:由用户决定写者向缓冲区中写入的内容,读者能够读出并显示出来;当缓冲区中没有数据时,读者要等待,直到缓冲区中有数据才能读根据“读者优先”加以改变,增加一个“写者优先”模式,并且由用户来选择模式

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 线程同步机制。 互斥器的功能和临界区域很相似。区别是:Mutex所花费的时间比Critical Section多的多,但是Mutex是核心对象(Event、...
    线程同步机制。 互斥器的功能和临界区域很相似。区别是:Mutex所花费的时间比Critical Section多的多,但是Mutex是核心对象(Event、Semaphore也是),可以跨进程使用,而且等待一个被锁住的Mutex可以设定TIMEOUT,不会像Critical Section那样无法得知临界区域的情况,而一直死等。-Thread synchronization mechanism. Mutex" s function and the critical region is very similar. The difference is: Mutex spent more time than the multi-Critical Section, but the Mutex is the core object (Event, Semaphore is), you can cross-process use, and has been locked waiting for a Mutex can be set to TIMEOUT, not as Critical Section did not know the critical situation in the region, for so long and so die.
    2023-07-23 08:05:05下载
    积分:1
  • 51单片机
    这是一个基于时间片的操作系统  通过时间分割 将51单片机 独立出N个低频单片机 并行运行程序,该系统有一定的实用性,特别是要驱动TFT屏的时候,在刷屏的同时单片机任能做其他事情,如果不是用操作系统,像51这种低端的单片机是做不到同时的,所以这个代码非常有学习的价值
    2022-01-21 21:11:52下载
    积分:1
  • 这是一个电梯模拟器,使用的概念叫互斥实现一..
    it s a lift simulator, use operating system concept call mutex to implenment a lift. I do it prefectly.-it sa lift simulator, use operating system concept call mutex to implenment a lift. I do it prefectly.
    2022-01-24 15:55:57下载
    积分:1
  • 使用VC在调用window Cmd 命令,并分析返回的结果来取得需要的数据。...
    使用VC在调用window Cmd 命令,并分析返回的结果来取得需要的数据。-The use of VC in the call window Cmd commands, and analyze the returned results to obtain the required data.
    2023-07-28 06:15:03下载
    积分:1
  • tcp/ip协议栈源码,用于源码开放的嵌入式实时uCOS-II。...
    tcp/ip协议栈源码,用于源码开放的嵌入式实时操作系统uCOS-II。 -tcp/ip protocol stack source code for open-source embedded real-time operating system for uCOS-II.
    2022-06-27 06:34:30下载
    积分:1
  • heycacher高性能缓存程序(源代码)1。所有文件美国..
    HeyCacher 高性能缓存方案(带源码) 1. 文件的所有权益归上传用户所有 2. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途 3. CSDN下载频道仅提供交流平台,并不能对任何下载内容负责 4. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。 5. 本站不保证本站提供的下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。 -HeyCacher high performance caching program (with source code) 1. All documents uploaded to the interests of users 2. rights without the consent of the owner shall document the contents of the diversion of commercial uses three or profits. CSDN download channel only provide a platform for the exchange, and not for any download for four. download documents if violations or inappropriate content. Please contact us, we immediately corrected. 5. The site does not guarantee that the site provides resources to download the accuracy, security and integrity. Users assume the same time not by the use of these resources to download their own and other people have any form of injury or loss.
    2022-07-20 18:30:44下载
    积分:1
  • 这个文件最初在一个m
    这个文件最初在一个m-ix86pm的UCOS For 386包中, 但是没有源代码,原名叫ExeToImg.EXE 用于将PE结构的EXE文件转换为内存映像文件, 可用于在WIN平台上开发基于x86的操作系统 这个源代码编译后效果跟原版差不多,是我用OllyDBG反编译写成C的. 对于学习PE文件及操作系统有一定作用, 毕竟我的大部分的操作是在window下, 机器差得要得,不想用虚拟机在linux下编译入门的操作系统. 像中的Tinux -This document was originally in a m-ix86pm the UCOS For 386 package, but no source code, the original name used to ExeToImg.EXE structure of PE files into memory EXE image file that can be used in the WIN platform x86-based operating system of the source code compiled with the original effect is almost that I wrote with OllyDBG decompile C
    2022-03-22 06:43:00下载
    积分:1
  • Windows资源浏览器外壳扩展右键菜单功能的实例程序
    Windows资源浏览器外壳扩展右键菜单功能的实例程序-Windows Explorer context menu shell extension examples of procedures
    2023-08-09 16:40:05下载
    积分:1
  • 本次程序的题目为:进程管理――支持多个进程并发运行的简单的进程管理模拟,对本实验的分析要求是:⑴中的同步机构采用信号量上的P、V的机制;⑵控制机构包...
    本次程序的题目为:进程管理――支持多个进程并发运行的简单的进程管理模拟系统,对本实验的分析要求是:⑴系统中的同步机构采用信号量上的P、V操作的机制;⑵控制机构包括阻塞和唤醒操作;⑶时间片中断处理程序处理模拟的时间片中断;⑷进程调度程序负责为各进程分配处理机;⑸根据用户的需求来创建n个进程(n为即满足用户需求,又不超出系统可容的最大进程数),各进程互斥地访问使用临界资源 S1、S2;⑹使用动态优先数(如:随阻塞次数的增加而减小优先数,以提高其优先权);⑺进程结束后应能够撤消;⑻进程间能实现“发送”和“接收”两个消息缓冲通信操作;⑼系统在运行过程中随机打印出各进程的状态变换过程、系统的调度过程及公共变量的变化情况,在一个进程运行完毕,进入完成状态后,可以将该进程撤消,也可以动态的创建另一个新的进程。-the procedures on the topic of : process management-- to support multiple concurrent processes running a simple process management simulation system for the analysis of the experimental requirements are : 1 system of institutions using synchronous signals on the amount of P, V operation of the mechanism; 2 control agencies, including obstruction and awaken operation ; 3-time interrupt handling procedures-time simulation of interruption; 4 process scheduler is responsible for the allocation process processors; together according to the user"s needs to create process n (n that meet user needs, without exceeding the system can accommodate
    2022-11-14 01:00:03下载
    积分:1
  • 通过研究Linux的线程机制和信号量实现读者写者(Reader
    通过研究Linux的线程机制和信号量实现读者写者(Reader-Writer)问题并发控制。 1)写-写互斥:不能有两个写者同时进行写操作; 2)读-写互斥:不能同时有一个线程在读,而另一个线程在写; 3)读-读允许:可以有一个或多个读者在读; 4)读者优先的附加限制:如果读者申请进行读操作时已有另一个读者正在进行读操作,则该读者可直接开始读操作; 5)写者优先的附加限制:如果一个读者申请进行读操作时已有另一个写者在等待访问共享资源,则该读者必须等到没有写者处于等待状态后才能开始读操作。 -By studying the Linux thread mechanism and semaphores realize readers who write (Reader-Writer) the issue of concurrency control. 1) to write- write mutex: Can not write at the same time there are two write operations 2) read- write mutex: Can not have a thread at the same time in reading and writing another thread 3) Reading- Reading of permit: can have one or more readers read 4) the priority of additional restrictions readers: If the readers apply for a read operation, there was another reader being read, the reader can be directly started reading operation 5) to write additional priority Restrictions: If an application for a reader reading write operation has been in waiting for another visit to a shared resource, the read
    2022-02-06 09:26:49下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载