deadlocked code | Bytes (2024)

Theadmin77

deadlocked code | Bytes (1) 19 New Member

For some reason i am unable to compile or execute the following code ...look like a i have a deadlock or something like that ...

Could anyone send me into the right direction ? Thanks !!
This is the code:

Expand|Select|Wrap|Line Numbers

  1. intitemCount
  2. procedureproducer(){
  3. while(true){
  4. item=produceItem()
  5. if(itemCount==BUFFER_SIZE){
  6. sleep()
  7. }
  8. putItemIntoBuffer(item)
  9. itemCount=itemCount+1
  10. if(itemCount==1){
  11. wakeup(consumer)
  12. }
  13. }
  14. }
  15. procedureconsumer(){
  16. while(true){
  17. if(itemCount==0){
  18. sleep()
  19. }
  20. item=removeItemFromBuffer()
  21. itemCount=itemCount-1
  22. if(itemCount==BUFFER_SIZE-1){
  23. wakeup(producer)
  24. }
  25. consumeItem(item)
  26. }
  27. }

Oct 30 '07 #1

Subscribe Reply

4 deadlocked code | Bytes (2) 2150 deadlocked code | Bytes (3)

gpraghuram

1,275 deadlocked code | Bytes (5) Recognized Expert Top Contributor

For some reason i am unable to compile or execute the following code ...look like a i have a deadlock or something like that ...

Could anyone send me into the right direction ? Thanks !!
This is the code:

int itemCount

procedure producer() {
while (true) {
item = produceItem()

if (itemCount == BUFFER_SIZE) {
sleep()
}

putItemIntoBuff er(item)
itemCount = itemCount + 1

if (itemCount == 1) {
wakeup(consumer )
}
}
}

procedure consumer() {
while (true) {

if (itemCount == 0) {
sleep()
}

item = removeItemFromB uffer()
itemCount = itemCount - 1

if (itemCount == BUFFER_SIZE - 1) {
wakeup(producer )
}

consumeItem(ite m)
}
}

Please use code tqags while posting ur code.
U wint get a deadlock problem when compiling ur code.
Why there are no semi colons(;) in the code.
First tell me, whether ur code is compiling?

Raghuram

Oct 31 '07 #2

reply

Theadmin77

19 deadlocked code | Bytes (6) New Member

No unfortunately my code does not compile .

Oct 31 '07 #3

reply

sicarie

4,677 deadlocked code | Bytes (8) Recognized Expert Moderator Specialist

So what errors are you getting?

Oct 31 '07 #4

reply

Ganon11

3,652 deadlocked code | Bytes (10) Recognized Expert Specialist

Is this even C or C++? If it is, then you are missing semicolons everywhere. If not, then this is the wrong forum for this post.

Oct 31 '07 #5

reply

Sign in to post your reply or Sign up for a free account.

Similar topics

51 5252

OO in PHP

by: Mudge |last post by:

Please, someone, tell me why OO in PHP is better than procedural.

PHP

9 3858

FrontController Design Pattern and Code Reuse

by: bigoxygen |last post by:

Hi. I'm using a 3 tier FrontController Design for my web application right now. The problem is that I'm finding to have to duplicate a lot of code for similar functions; for example, listing users, and listing assignments use similar type commands. Is there a "better" way I can organize my code?

PHP

4 2426

somewhat painful join code

by: jason |last post by:

Hello. Newbie on SQL and suffering through this. I have two tables created as such: drop table table1; go drop table table2; go

Microsoft SQL Server

16 3099

Strange behaviour of simple code

by: Dario de Judicibus |last post by:

I'm getting crazy. Look at this code: #include <string.h> #include <stdio.h> #include <iostream.h> using namespace std ; char ini_code = {0xFF, 0xFE} ; char line_sep = {0x20, 0x28} ;

C / C++

1 2374

ExecuteXmlReader deadlocked exception; new to framework 1.1

by: Adam Smith |last post by:

When executing ExecuteXmlReader() against a table where records are being inserted, I get: 9/5/2003 8:39:47 AM Transaction (Process ID 66) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteXmlReader()

C# / C Sharp

1 1672

aspnet_wp.exe (PID: 1864) was recycled because it was suspected to be in a deadlocked state. It did not send any responses for pending requests in the last 180 seconds.

by: bmmodi |last post by:

Hello, We have three webservers that host the same web application (written in VB.NET running on .NET Framework 1.0 SP2). We receive the following error (aspnet_wp.exe (PID: 1864) was recycled because it was suspected to be in a deadlocked state. It did not send any responses for pending requests in the last 180 seconds.) every few days on ONLY ONE of the three servers. At the point when the error occurs, the CPU locks up at 100%. ...

ASP.NET

2 2829

aspnet_wp.exe in a deadlocked state

by: Antonio Concepcion |last post by:

Hi! We have an ASP.NET web site experiencing errors saying that aspnet_wp.exe got into a deadlock state and was recycled. Specifically the Client browser gets the following message: ***************************** Server Application Unavailable The web application you are attempting to access on this web server is currently

ASP.NET

6 1445

Dumping the state of a deadlocked process

by: andre.naess |last post by:

Hi all I'm currently having some issues with a process getting deadlocked. The problem is that the only way I can seem to find information about where it deadlocks is by making a wild guess, insert a pdb.set_trace() before this point, and then step until it locks up, hoping that I've guessed right. The frustrating part is that most of the time my guesses are wrong.

Python

18 6841

multiple threads writing to WebBrowser, getting deadlocked

by: Zytan |last post by:

I have multiple threads writing to WebBrowser (using a function that checks InvokedRequired, and if so, invokes itself on the WebBrowser thread) and they are getting deadlocked. They only deadlock when I use lock { } around the call to WebBrowser.Write to ensure thread safety! Does any one have experience with such a thing? Zytan

C# / C Sharp

8210

Changing the language in Windows 10

by: Hystou |last post by:

Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...

Windows Server

8646

Maximizing Business Potential: The Nexus of Website Design and Digital Marketing

by: jinu1996 |last post by:

In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...

Online Marketing

1 8371

The easy way to turn off automatic updates for Windows 10/11

by: Hystou |last post by:

Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...

Windows Server

8517

Discussion: How does Zigbee compare with other wireless protocols in smart home applications?

by: tracyyun |last post by:

Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...

General

7212

AI Job Threat for Devs

by: agi2029 |last post by:

Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...

Career Advice

5580

Couldn’t get equations in html when convert word .docx file to html file in C#.

by: conductexam |last post by:

I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...

C# / C Sharp

4095

Trying to create a lan-to-lan vpn between two differents networks

by: TSSRALBI |last post by:

Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

Networking - Hardware / Configuration

1 2634

transfer the data from one system to another through ip address

by: 6302768590 |last post by:

Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

C# / C Sharp

1 1819

How to add payments to a PHP MySQL app.

by: muto222 |last post by:

How can i add a mobile payment intergratation into php mysql website.

PHP

deadlocked code | Bytes (2024)

References

Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 5609

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.