Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

toni kukuoc

@toni kukuoc
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Synchronization using Semaphores
    T toni kukuoc

    You wrote: Now, I ask you, does arriving missionaries mean arriving at the departure boat or arriving at the other side of the river? I'm sooo confused!!! arriving at the departure boat You wrote: Is this an empty boat, ready to take on missionaries and cannibals, or is this a boat full of said people? yes this is empty boat and ready to take on missionaries and cannibals. You wrote: And exactly how many boats are on this river??? only one boat and/or two boat it is ur decision. You wrote: Since there's no upper limit on the number of cannibals and missionaries The number of cannibals must be greater than one, and the number of missionaries must be greater than two, finally the total number of persons should be multiples of three.ex:3 6 9 12 30 60 90 120 150 .....may be finally 210.ur choice You wrote: Certainly the instructions give NO CLUE as to how boats depart. Only arrive. So, in the end, the missionaries and cannibals should just be able to walk across the river, going from boat to boat. But to figure this out, we need to know more information about the river, it's width, the current, the size of each boat, etc. These are not input parameters! these ar not important.across the river 3 to 3 is important thing.others are not important. You wrote: How dumb is that! The parameters are clear: (M+A)/3 must not have a remainder. And each boat must be full. IT'S IMPOSSIBLE TO HAVE PERSONS LEFT AT THE END OF THE PROGRAM!!! at the end of the program you can print all missionaries and cannibals across the river. You wrote: Who should they be reported to? The missing person's bureau? The only way I figure there can be persons left at the end is if the missionaries succeed in converting some of the cannibals to missionaries while waiting for a boat! this is not important again. if you can do this homework with C, i am thanked you Thanks a lot:confused::confused: codingggggggggggggggggggg

    The Lounge lounge

  • Synchronization using Semaphores
    T toni kukuoc

    A particular river crossing is shared by both cannibals and missionaries. A boat is used to cross the river but it only seats three people and must always carry a full load. In order to guarantee the safety of the missionaries, you can not put one missionary and two cannibals into the same boat (because cannibals would gang up and eat that single missionary), but all other combinations are legal. Your program will first ask the number of missionaries and cannibals. The number of cannibals must be greater than one, and the number of missionaries must be greater than two, finally the total number of persons should be multiples of three. First, you should create processes for each cannibal and missionaries. They will walk to the river bank for a while (arrival times are random, you can use sleep call here). Two procedures are needed, Missionary_Arrived and Cannibal_Arrived called by missionary or cannibal processes when they arrive the river bank. These procedures are responsible for synchronization. And these procedures arrange arriving missionaries and cannibals into safe boatloads. Once the boat is full, one process calls Raw_Boat and after calling Row_Boat, the three procedures then return. Then a new boat arrives. There should also be no undue waiting; that is missionaries and cannibals should not wait if there are enough of them for a safe boatload. Your program should display how a boat is arranged each time and who is on the boat. If there are any persons left at the end of your program, they must be reported. Remember that, all the synchronization operations should be mutually exclusive. You must use UNIX semaphores to enable synchronization. codingggggggggggggggggggg

    The Lounge lounge
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups