unix c deadlock program... 
Author Message
 unix c deadlock program...

: hello,

: i was wondering..  does anyone know how to write a deadlock program with semaph
: ores in unix c??  i did the following:

[deletions]

Why would you want to write such a program?

-Jeff
--
Jeffrey N. Woodford      | "All the world's indeed a stage, And we are merely

Physical Chemistry Graduate Student, University of Nebraska - Lincoln



Tue, 18 Nov 1997 03:00:00 GMT  
 unix c deadlock program...

 > : i was wondering..  does anyone know how to write a deadlock program with semaph
 > : ores in unix c??  i did the following:


 > Why would you want to write such a program?

Hmmmm....we had to write something like that in our operating systems
internals class.

Homework posts are starting early this year, I guess.

----
* Billy Chambless  

* Mississippi State University Center for Air-Sea Technology



Tue, 18 Nov 1997 03:00:00 GMT  
 unix c deadlock program...
: hello,

: i was wondering..  does anyone know how to write a deadlock program with semaph
: ores in unix c??  i did the following:

: main()
: {
:   while (1) {
:      fork();
:      malloc(1024);
:   }
: }

: this does deadlock to a point, but i dont think it access any kind of critical
: sections...  any help would be appreciated..

No it doesn't. You'll either run out of processes or memory, but you
won't deadlock, since none of your forked processes wait for anything.

Deadlocks are where process A is waiting for process B to do something
while process B is waiting for process A to do something (that something
could be releasing a semaphore, unlocking a file, etc).

--


#510 8210 111 St.                    phone: 439-1939
Edmonton, AB, T6G 2C7



Tue, 18 Nov 1997 03:00:00 GMT  
 unix c deadlock program...
hello,

i was wondering..  does anyone know how to write a deadlock program with semaph
ores in unix c??  i did the following:

main()
{
  while (1) {
     fork();
     malloc(1024);
  }

Quote:
}

this does deadlock to a point, but i dont think it access any kind of critical
sections...  any help would be appreciated..

ciao,
mike.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
michael f. malto                         | good quotes??? if so email me.



Tue, 18 Nov 1997 03:00:00 GMT  
 unix c deadlock program...

   : hello,

   : i was wondering..  does anyone know how to write a deadlock program with semaph
   : ores in unix c??  i did the following:
     [...]

Why do you want get a deadlock? But it's OK... I don't know its C
syntax but I can give you a way to get 2 processes deadlock.  There it
goes:

PS: IT'S NOT C SYNTAX!!!

Process A               Process B
---------               ---------
lock(A)                 lock(B)
wait_key_stroke         wait_key_stroke
lock(B)                 lock(A)

Execute both and press a key in one and then in other process
and... "voila", they're deadlocked (I guess... ;)
Use ^C to kill the processes.

Now... can anybody give a C code for this?

Hope this helps...

--


Comp. Engineering undergrad. student  | WWW: http://www.dcc.unicamp.br/~mauronr



Wed, 19 Nov 1997 03:00:00 GMT  
 unix c deadlock program...

:  > : i was wondering..  does anyone know how to write a deadlock program with semaph
:  > : ores in unix c??  i did the following:


:  > Why would you want to write such a program?

: Hmmmm....we had to write something like that in our operating systems
: internals class.

Oh, then my apologies to the original poster.  I thought he was trying
to do something destructive.

-Jeff
--
Jeffrey N. Woodford      | "All the world's indeed a stage, And we are merely

Physical Chemistry Graduate Student, University of Nebraska - Lincoln



Wed, 19 Nov 1997 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Program from "Unix Network Programming"

2. Recompile Unix C/C++ Program to .NET

3. Resources for learning to program C/C++ (especially in a UNIX environment)

4. Advice - C Programming Books for Unix (Solaris 2.x)

5. Programming a deamon in C for Unix

6. Unix Network Programming by Stevens

7. Running unix command is C program

8. Recommend C programming in Unix

9. Calling Unix commands from C program?

10. Unix Cmds in a C program

11. A C program that calls unix shell scripts

12. Unix programming for Oracle Database

 

 
Powered by phpBB® Forum Software