{"id":25063762,"url":"https://github.com/rihib/lamport-clock-simulator","last_synced_at":"2025-10-21T18:31:03.132Z","repository":{"id":246518138,"uuid":"821364753","full_name":"rihib/lamport-clock-simulator","owner":"rihib","description":"Simulate Lamport Clock with CLI","archived":false,"fork":false,"pushed_at":"2024-06-29T15:12:17.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-14T09:13:10.674Z","etag":null,"topics":["c","cli-app","concurrent-programming","distributed-systems","golang","happens-before","lamport-clock","logical-clocks","multiprocessing","multithreading","mutual-exclusion","simulator","socket-programming"],"latest_commit_sha":null,"homepage":"https://doi.org/10.1145/359545.359563","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rihib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-28T11:27:28.000Z","updated_at":"2024-06-29T15:12:20.000Z","dependencies_parsed_at":"2024-06-29T07:22:04.246Z","dependency_job_id":"ff9c3f95-288f-46ed-8194-757a98220c28","html_url":"https://github.com/rihib/lamport-clock-simulator","commit_stats":null,"previous_names":["rihib/lamport_clock","rihib/lamport-clock-simulator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rihib%2Flamport-clock-simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rihib%2Flamport-clock-simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rihib%2Flamport-clock-simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rihib%2Flamport-clock-simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rihib","download_url":"https://codeload.github.com/rihib/lamport-clock-simulator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237530830,"owners_count":19325217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cli-app","concurrent-programming","distributed-systems","golang","happens-before","lamport-clock","logical-clocks","multiprocessing","multithreading","mutual-exclusion","simulator","socket-programming"],"created_at":"2025-02-06T18:45:29.687Z","updated_at":"2025-10-21T18:30:57.823Z","avatar_url":"https://github.com/rihib.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lamport Clock Simulator\n\n## What is Lamport Clock?\n\nLamport Clock is a logical clock used to determine the order of events in a distributed system. It was introduced by Leslie Lamport in 1978[1]. It is not a physical clock but a logical clock that helps to determine the order of events in a distributed system.\n\nLamport Clocks are used to establish a partial ordering of events in a distributed system. Each process in the system maintains a logical clock that is incremented for each event it generates. When a process sends a message, it includes its logical clock value in the message. When a process receives a message, it updates its logical clock value to be greater than the maximum of its current value and the value in the received message.\n\n[1] Leslie Lamport. 1978. Time, clocks, and the ordering of events in a distributed system. Commun. ACM 21, 7 (July 1978), 558–565. https://doi.org/10.1145/359545.359563\n\n## How to use this implementation?\n\nThis implementation simulates the operation of the Lamport clock with the CLI.\n\n### Setting up the environment\n\n```bash\ngit clone https://github.com/rihib/lamport-clock-simulator.git\ncd lamport-clock-simulator\ngo run main.go 9000\ngo run main.go 9001 // Open a new terminal\ngo run main.go 9002 // Open a new terminal\n```\n\n### Running the simulation\n\nYou can send and receive messages and perform computation events and see how the Lamport Clock value changes each time you do so.\n\n```bash\n// Terminal 1\n% go run main.go 9000\nPlease type event, c or s: c\nCalculate Event Success!!\nTime: 1\n\nPlease type event, c or s: c\nCalculate Event Success!!\nTime: 2\n\nPlease type event, c or s: s\nPlease type the destination port: 9001\nSending Event Success!!\nTime: 3\n\nPlease type event, c or s:\n```\n\n```bash\n// Terminal 2\n% go run main.go 9001\nPlease type event, c or s:\nMessage Received!!\nTime: 4\n\nPlease type event, c or s:\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frihib%2Flamport-clock-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frihib%2Flamport-clock-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frihib%2Flamport-clock-simulator/lists"}