Find Jobs
Hire Freelancers

small project in networking

₹600-1500 INR

Closed
Posted 6 months ago

₹600-1500 INR

Paid on delivery
Description: You are asked to develop a distributed mutual exclusion primitive for a number of processes running on the computers on a single switched LAN (our Linux lab). System Architecture: Process1 Process2 Process3 Process4 ... | | | | | | | | | LAN | | | |------------------|--------------|---------------|----- The client and servers are running Network File System (NFS) so that user files are visible at $HOME directory. You may want to set up the following environment: $HOME/[login to view URL]: a list of computers (hostnames) which are running processes that need the distributed mutual exclusion. There is no reason why your implementation cannot support up to 5 servers. Your implementation must follow the distributed mutual exclusion algorithm descrbied below. A process sends a REQUEST message to all other processes to request their permission to enter the critical section. A process sends a REPLY message to a process to give its permission to that process. Processes use Lamport-style logical clocks to assign a timestamp to critical section requests and timestamps are used to decide the priority of requests. Each process pi maintains the Request-Deferred array, RDi , the size of which is the same as the number of processes in the system. Initially, ∀i ∀j: RDi [j]=0. Whenever pi defer the request sent by pj , it sets RDi [j]=1 and after it has sent a REPLY message to pj , it sets RDi [j]=0. Requesting the critical section: When a site S i wants to enter the CS, it broadcasts a timestamped REQUEST message to all other sites. When site S j receives a REQUEST message from site S i , it sends a REPLY message to site S i if site S j is neither requesting nor executing the CS, or if the site S j is requesting and S i ’s request’s timestamp is smaller than site S j ’s own request’s timestamp. Otherwise, the reply is deferred and S j sets RD j [i]=1 Executing the critical section: Site S i enters the CS after it has received a REPLY message from every site it sent a REQUEST message to. Releasing the critical section: When site S i exits the CS, it sends all the deferred REPLY messages: ∀j if RD i [j]=1, then send a REPLY message to S j and set RD i [j]=0. Notes: When a site receives a message, it updates its clock using the timestamp in the message. When a site takes up a request for the CS for processing, it updates its local clock and assigns a timestamp to the request. Test: To demonstrate your distributed mutual exclusion primitive is working, you must provide a test program that is running at all computers listed in your [login to view URL] file. In the test, you may want to simulate a bank account balance inquiry, deposit, and withdraw operations from all computers. The application program must invoke the distributed mutual exclusion primitive before and after the actually bank account read/write operations. Implementation Guidance: Message Structure: struct msg_packet { unsigned short cmd; // command, e.g., HELLO | HELLO_ACK | REQUEST | REPLY (HELLO & HELLO_ACK are additional command for debugging purposes) unsigned short seq; // sequence number of avoid duplicates unsigned int hostid; // this is optional because you can obtain the host (sender) information from the ip header, we add this fied for the convenience. unsigned short vector_time[5]; // support upto to 5 hosts }; [login to view URL]: You may artificially give an ID to each host. For example: [login to view URL] 0 [login to view URL] 1 [login to view URL] 2 [login to view URL] 3 Therefore, the timestamps will be in the same order for each host. The host ID (as the index) is also useful for managing the deferred array. Blocking: When a process sends a request but does not receive all replies, this process will be blocked until it receive all the replies. When you use the UDP platform, this blocking is automatically done for you when you invoke recvfrom function. Note, you need to maintain a counter that counts how many REPLY messages you receive from all other hosts. If no enough REPLY received, you still need to call recvfrom function (and therefore the process is blocked). Requirements: You can only use C programming lanuage to complete this project. Your implementation should not rely on any extra library (to compile your code). Your code must compile by using gcc installed on the Linux workstations in FH 133. Your distributed mutual exclusion primitive must be based on UDP based message passing. 3. (30 points) The UDP networking platform (code) is provided. [login to view URL] Your implement must be built on the provide UDP platform and perform a message communication test as described in the following: Suppose you have 5 server with their IDs: 0, 1, 2, 3, 4 (contained in $HOME/[login to view URL]). Servers with IDs 1, 2, 3, and 4 should be running first and doing nothing (listening); Server 0 runs next. Server 0 sends a "Hello" message (can be emulated by 4 unicasts) to all other servers; Once a server receives a "Hello" message, it immediately replies the sender with a unicast message "Reply". When servers 1, 2, 3, and 4 receive a "Hello" from server 0, they wait for a certain amount of time and then each of them sends a "Hello" to everyone else. The waiting time is arranged as the following: server1: 2s; server2: 3s; server3: 5s; server4:7s. The response to the "Hello" messages from server 1, 2, 3, & 4, should be the same way responding the "Hello" from server 0. Each server prints out the messages it receives with the following format: the sender ID: the message content 4. (60 points) Your distributed mutual exclusion primitive must provide a clean interface (API) such that application programmers only need to invoke the lock and unlock calls before and after the program enters the critical section. While the lock is not available, the calling process must be suspended and be waiting for the availability of the lock. Busy waiting is not allowed. DIstributed Mutual Exclusion API: 1. int distributed_mutex_init(); for initialization, should be called by the user who wants to use the distributed_mutex primitive; in addition to variable initialization, init() should create a pthread that is listening on port 0x3333 (for incoming message) return an int: 0 indicates normal and ready; -1 indicates an error. 2. int distributed_mutex_lock(); before the calling user enters in the critical section, the user must obtain this lock. Or the user should be blocked (waiting) return an int: 0 indicates normal; -1 indicates an error. 3. int distributed_mutex_unlock(); it's the user's responsibility to call unlock before leaving the critical section. this API should send queued (deferred) REPLY messages to the sending hosts according the procotol described above. return in int: 0 indicates normal; -1 indicates an error. Makefile: you need to provide a Makefile that allows the instructor to compile your code by simply typing "make" (10 points) README: you are required to write a README document (in txt format) that describes your project design detail and the execution sequence (with the commands). In particular, please explicitly state which part, if there is any, does not work and the possible reasons why that module does not work. For those working modules, please give a brief (in short) sample output. *********************** Further Hint: Server Process Implementation Details. ************************************ Note that two or more processes may send the requests simultaneously. To respond the requests instantaneouly and timely, each server process should process the requests concurrently. That is, for each received request, a new thread (using Linux pthread library) should be spawned to service this request. The duty of the spawned thread is to process the incoming message. It's duty includes, but not litmited to, in the following: 1. If the host receives a REQUEST message and the host is not requesting, sends a REPLY immediately; 2. If the host receives a REQUEST message and the host is also requesting: a) the host has a vector time earlier than that of REQUEST, defer the REPLY and put the REQUEST in the queue; b) the host has a vector time later than that of REQUEST, sends a REPLY immediately. 3. If the host receives an other message, e.g., HELLO, replies an ACK immediately. The communication between the spawned thread and the main thread (distributed_mutex_lock()) can be done through pthread semaphore: int distributed_mutex_lock(void) { // parameter setting is up to you sem_init(&sem, 0, 4); // creatte a semaphore with a value of 5 (assuming there are 5 hosts, so we need to collect 4 REPLYs to proceed) ### sem_init(&sem, 0, 0); // initialize a semaphore with value 0 (have not received n-1 REPLYs yet): automatically blocking ### send REQUESTs to other hosts for entering CS sem_wait(&sem); // if the value goes below 4, the distributed_mutex_lock will wait until someone else adds // if the value is zero, the distributed_mutex_lock will wait until someone does sem_post(&sem) // reached here since all REPLYs are collected return 0; // allow the user to enter CS } In your spawned thread that processes the incoming messages, if it is a REPLY message, then you should do: sem_post(&sem). ### correction: if a REPLY message is received, this thread should increase the REPLY counter by 1 ### sem_post(&sem) should only be invoked, which will increase the sem value by 1, if the REPLY counter is not n-1 yet. ### here you do need to maintain a REPLY counter, which should be protected by a (pthread) mutex. ### before doing sem_post(&sem), you also need to reset the REPLY counter back to zero. ###
Project ID: 37443247

About the project

7 proposals
Remote project
Active 5 mos ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
7 freelancers are bidding on average ₹1,143 INR for this job
User Avatar
Hello Dear, I am an Expert Network Engineer and I am working as Professor and Expert Consultant Network Engineer in a Multinational ISP. I have great hands-on experience for more than 10 years in various network technologies. I have Cisco CCIE Enterprise , CCIE DataCenter and Cisco Specialist - Enterprise SD-WAN Implementation and Juniper JNCIA-Junos (JN0-102) and JNCIA (Cloud) certificates. I have very good knowledge in Cisco wireless technology, VOIP & Network Security. My specialties: - Design/implement medium and large scale enterprise networks. - Configure Cisco Routers (ASR 1K & 9k, 2900, 2800, ISR 4K, 878, 888), Switches (Cat 6500, 3750, 3850, 2900, 2960, SG- 300, SG-500, [Nexus 5K, 7K and 9K]), Firewalls ([ASA 5505, 5506x, 5508], Fortigate, Palo Alto) and Wireless Acess Points 1800 and 2700. - Configure Juniper Routers (M7, M10, MX 480, MX 960) and SRX (300, 500). - Huawei, Mikrotik, HP & Ubiquiti devices Expert. - Packet Tracer, GNS-3, EVE-NG, VMWare workstation & VirtualBox Expert. - Routing protocols (RIP, OSPF, EIGRP, ISIS & BGP) Configuration and troubleshooting Expert and Switching Expert (VLANs, STP, VTP...). - VPN Configuration Expert (IPSEC/L2TP, GRE/PPTP, OPENVPN & SoftEther). - Linux, Unix & windows servers Expert. - Wireshark Traffic Capture & Analysis Expert. - Write technical reports and summaries. Thanks to check my profile and let me know if you are interested. Best Regards,
₹1,050 INR in 1 day
4.8 (61 reviews)
5.9
5.9
User Avatar
Hello sir ! I have more than 2 years hands-on experience in the field of networking and cybersecurity. I'm sure I can handle this task perfectly. please hire me for this and expect a high quality result.
₹1,500 INR in 7 days
5.0 (3 reviews)
3.6
3.6
User Avatar
Hello, my name is A.K.M. Tohidur and I am an experienced network and system administrator with over 08 years of experience in networking and system administration. I have significant experience in setting up home networks and configuring firewalls as well as solving related problems. I have the required knowledge and skills to complete your project within a week's timeline. I understand that you are seeking assistance with a specific networking task: setting up a home network, configuring a firewall, troubleshooting network connectivity issues. As part of the project, I would use my expertise in networking and system administration to effectively complete the project within the week timeline required. I am confident that my proficiency in networking and system troubleshooting coupled with experience in setting up home networks and configuring firewalls will yield successful results for your project. Please feel free to contact me if you would like further information or if you would like to discuss this project further.
₹1,050 INR in 1 day
5.0 (7 reviews)
3.0
3.0
User Avatar
Hello, my name is Nasreen, and I am the founder of vServices Ltd. We specialize in providing high quality, cost-effective and need-based solutions to our customers. I understand that you are seeking assistance with a specific networking task, and we believe we are the best fit for this job due to our expertise in networking and firewalls. We have a team of experts with us who have the necessary skills to complete the project within a week's timeframe. Additionally, we always make sure that our clients get top quality service at all times. I would be delighted if you could consider us for this project, and I look forward to hearing from you soon!
₹1,050 INR in 7 days
0.0 (0 reviews)
0.0
0.0
User Avatar
I have done a lot of research in networking field. Networking concepts always excites me. It was my favourite subject during college days and recently worked on few socket programming projects.
₹1,050 INR in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Hi I am a C++ developer and I can help you with your task,if you're interested in me, e-mail me. ? best regards Nikita Marchenko
₹1,050 INR in 2 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of INDIA
Vijayawada, India
0.0
0
Member since Nov 17, 2023

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.