Sponsored Content
Full Discussion: Synchronization process
Homework and Emergencies Homework & Coursework Questions Synchronization process Post 302895244 by mariam40 on Sunday 30th of March 2014 04:26:42 AM
Old 03-30-2014
Synchronization process

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:

it is assumed that the five processes are available according to the graph (cycle is formed of five process).
each process has two neighboring processes. they would apply ordonnencement (synchronization) of the five processes. if the process Pi execute its function Gi (), neither of these two neighboring process can execute its function. example if the P2 execute G2() function then P1 and P3 should be prevent to execute their functions G1 () and G3 () respectively.
using tubes communications (pipe) write the necessary code this synchronization
2. Relevant commands, code, scripts, algorithms:



3. The attempts at a solution (include all code and scripts):
Code:
 
 /*I used 5 pipes .*/
 int t125[2],t123[2],t234[2],t345[2],t145[2];int x;
 if(i==1)
 {read(t123[0],&x,sizeof(int));
 read(t145[0],&x,sizeof(int));
 G1();
 write(t125[1],&x,sizeof(int));
 write(t125[1],&x,sizeof(int));
 }
 if(i==2)
 {read(t125[0],&x,sizeof(int));
 read(234[0],&x,sizeof(int));
 G2();
 write(t123[1],&x,sizeof(int));
 write(t123[1],&x,sizeof(int));
 }
 if(i==3)
 {read(t123[0],&x,sizeof(int));
 read(t345[0],&x,sizeof(int));
 G3();
 write(t234[1],&x,sizeof(int));
 write(t234[1],&x,sizeof(int));
 }
 if(i==4)
 {read(t234[0],&x,sizeof(int));
 read(t145[0],&x,sizeof(int));
 G4();
 write(t345[1],&x,sizeof(int));
 write(t345[1],&x,sizeof(int));
 }
 if(i==5)
 {read(t125[0],&x,sizeof(int));
 read(t345[0],&x,sizeof(int));
 G5();
 write(t145[1],&x,sizeof(int));
 write(t145[1],&x,sizeof(int));
 }

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Lebanese university,beirut,lebanon,sami,Operating system II.

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Synchronization process-20140330_111942-1-.jpg

Last edited by mariam40; 03-30-2014 at 05:29 AM.. Reason: forget
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Date synchronization

Hi all Is there an easy way to synchronize the time of a Linux server with another server (Linux or Windows). I need to do this on a daily basis so that my clock does is insync. Is synchronizing with an eternal server hazardous to the security of the box? Thanks in advance KS (2 Replies)
Discussion started by: skotapal
2 Replies

2. UNIX for Dummies Questions & Answers

Time synchronization

All What is the best way to keep the system clock synchronized? I have looked at ntp and netdate. Is one good over the other? Basically I want to know if what is the most secure way to keep the system clock insync. netdate will require me to open up some port 37... is this safe? ntp also... (1 Reply)
Discussion started by: skotapal
1 Replies

3. UNIX for Advanced & Expert Users

time synchronization

i have an HP UNIX box w/c acts as ntp server... I tried to change the time plus 8 minutes... the problem is that the other HP UNIX ntp client did not follow the time... when I tried to restart ntp client... using stop start it only sync to the server once... when I issue the command "ntpq -p", w/c... (2 Replies)
Discussion started by: inquirer
2 Replies

4. UNIX for Advanced & Expert Users

Synchronization of 2 directories

I have 2 hosts (server and client), on the client side I mount remote directory (through NFS). How can I synchronize content of 2 directories (one on the client, and one on the server, mounted to the client)? i.e. when client is connected to the server synchronization process is automatically... (5 Replies)
Discussion started by: Hitori
5 Replies

5. AIX

Date Synchronization

I want to synchronize my AIX 5.3 server with the server NTP windows using the ntpdate commande but there was a difference about 9 hours after synchro. here is my script and the result # date Tue Apr 10 18:58:06 CDT 2007 # ntpdate 192.168.10.212 10 Apr 09:58:19 ntpdate: step time server... (5 Replies)
Discussion started by: tovohery
5 Replies

6. UNIX for Dummies Questions & Answers

Server Synchronization

I am new on UNIX system. I am administrating a server belongs to a small department. It has Debian installed, and used as mail, web server. I am trying to synchronize to a different machine which has Fedora installed. Can anybody tell me how to copy exact image of one server to a different for ... (3 Replies)
Discussion started by: kumarrana
3 Replies

7. UNIX for Dummies Questions & Answers

directory synchronization

Can anybody help me on how to do directory synchronization. i have been reading about rsync and filesync but apparently it seems to me that synchronization is from a source directory to a destination directory only. how about if vice versa - wherein i need to synchronize both directories, updating... (3 Replies)
Discussion started by: splakang25
3 Replies

8. Shell Programming and Scripting

FTP Synchronization

I want to do a synchronization from local to ftp. local: name modified time a.txt 10:04 c.txt 10:05 ftp: b.txt 10:00 c.txt 10:05 final result would be a.txt copy to ftp b.txt deleted c.txt nothing to do Is there a good way to do so? Thanks. (3 Replies)
Discussion started by: uativan
3 Replies

9. Shell Programming and Scripting

Synchronization of folders

Hi guys and girls :) I have some problem with folder synchronization. I have a hudson job that make special build from svn data (check outing full project every time), after build folder is synchronized with second folder lets call them build and destination :) Currently I'm copying build to... (1 Reply)
Discussion started by: cvi
1 Replies

10. Solaris

I need to synchronization by rsync

Hi everyone! I wonder about the rsync. The purpose I just want: synchronization from server 1 to server 2 by rsync, example: Node 1: /app/logs/* Node 2: /app/logs/* in Node 1 when I used rsync -aru /app/logs/ node2:/app/logs/, then everything will be copied and update to node 2. But,... (1 Reply)
Discussion started by: trantuananh24hg
1 Replies
mktemp(3C)						   Standard C Library Functions 						mktemp(3C)

NAME
mktemp - make a unique file name from a template SYNOPSIS
#include <stdlib.h> char *mktemp(char *template); DESCRIPTION
The mktemp() function replaces the contents of the string pointed to by template with a unique file name, and returns template. The string in template should look like a file name with six trailing 'X's; mktemp() will replace the 'X's with a character string that can be used to create a unique file name. Only 26 unique file names per thread can be created for each unique template. RETURN VALUES
The mktemp() function returns the pointer template. If a unique name cannot be created, template points to a null string. ERRORS
No errors are defined. EXAMPLES
Example 1 Generate a filename. The following example replaces the contents of the "template" string with a 10-character filename beginning with the characters "file" and returns a pointer to the "template" string that contains the new filename. #include <stdlib.h> ... char *template = "/tmp/fileXXXXXX"; char *ptr; ptr = mktemp(template); USAGE
Between the time a pathname is created and the file opened, it is possible for some other process to create a file with the same name. The mkstemp(3C) function avoids this problem and is preferred over this function. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
mkstemp(3C), tmpfile(3C), tmpnam(3C), attributes(5), standards(5) SunOS 5.11 15 Sep 2004 mktemp(3C)
All times are GMT -4. The time now is 01:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy