preview

Differences Between Two Languages Based On The Languages

Better Essays

Summary The main aim of this report is to highlight differences between two languages based on the program developed for both the languages. A reader-writer program was created in two languages, i.e. JAVA and PYTHON. The program creates 4 threads each of which performs 5 read/write operations to the shared location. These threads simulate a coin flip. If the coin flip results in Heads (H) - Reading from the shared location is performed and if the coin flip results in Tails (T) – Writing to the shared memory location is performed. To achieve this concurrency and parallel programming, Semaphores and Monitor is used. Based on the output of the programs, two languages are then differentiate based on certain given comparison and evaluation criteria and concluded which of the two chosen languages is better for concurrency and simultaneously programming. Keywords: Semaphore, Monitor, Reader-Writer, Concurrency, Thread. 1. Introduction Concurrency and Parallel programming in Computer Science, refers to act of performing several computations simultaneously by interacting with each other and using the same memory location to perform various operations. Reader-Writer is a common example of concurrency and parallel programming. In this problem, multiple threads access the same memory location at any given time. Two or more threads can read from the shared location at the same time, but same cannot be said for the writer. When a writer thread is writing, no other thread, whether it’s a

Get Access