Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,515 members, 7,819,857 topics. Date: Tuesday, 07 May 2024 at 03:45 AM

What Is Concurrency And How Does Your Language Tackle It? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / What Is Concurrency And How Does Your Language Tackle It? (1572 Views)

How Do You Learn Your Language / How Does A Rookie Java/j2ee Programmer Get A Job? (2) (3) (4)

(1) (Reply) (Go Down)

What Is Concurrency And How Does Your Language Tackle It? by johnbendie(m): 9:29am On Mar 15, 2012
Hello Nairalanders, I have been banging my head against the wall trying to understand concurrency. I have made some progress but I still cannot grab the concept fully. So I will appreciate some code samples illustrating the phenomena and some pointers as to how your language tackles the problem.

John
Re: What Is Concurrency And How Does Your Language Tackle It? by Seun(m): 10:06am On Mar 15, 2012
Concurrency in the context means being able to speed up your programs by running them on more than one CPU core, CPU, or computer system at the same time. Python, my favorite programming language, supports concurrency for IO bound programs by providing threading abstractions (threads, locks, queues, event objects, etc). However, the Python interpreter is encumbered by a global interpreter lock which prevents CPU-bound python programs from taking advantage of multiple cores or CPUs. As a result, Python now provides a multiprocessing module that provides thread-like abstractions in a multi-process context (processes, locks, queues, event objects, etc), allowing CPU-bound Python programs to enjoy more concurrency quite easily.

1 Like

Re: What Is Concurrency And How Does Your Language Tackle It? by kodewrita(m): 12:44pm On Mar 15, 2012
@op, take that and call me in the morning ^^.
Re: What Is Concurrency And How Does Your Language Tackle It? by Kobojunkie: 1:47pm On Mar 15, 2012
@Poster, what you need to do is your own research. Even the wiki page on the subject explains quite a bit.

1 Like

Re: What Is Concurrency And How Does Your Language Tackle It? by Beaf: 12:12am On Mar 16, 2012
Seun: Concurrency in the context means being able to speed up your programs by running them on more than one CPU core, CPU, or computer system at the same time. Python, my favorite programming language, supports concurrency for IO bound programs by providing threading abstractions (threads, locks, queues, event objects, etc). However, the Python interpreter is encumbered by a global interpreter lock which prevents CPU-bound python programs from taking advantage of multiple cores or CPUs. As a result, Python now provides a multiprocessing module that provides thread-like abstractions in a multi-process context (processes, locks, queues, event objects, etc), allowing CPU-bound Python programs to enjoy more concurrency quite easily.

You are spot on, however the bolded is more about dealing with the consequence of every computers inability to handle perfectly simultaneous requests.
Its subtle, but concurrency is the simultaneous demand on processing resources by calculations.

1 Like

Re: What Is Concurrency And How Does Your Language Tackle It? by johnbendie(m): 3:37am On Mar 16, 2012
@Seun:Thanks for a very clear explanation and sharing some of your languages approach to the issue. I was also hoping you could throw in some code to show the problem and then some more to show how it was solved with the additional library.

@kobojunkie: You're very right research is necessary at this point but sharing what you know on the subject can serve to throw more light on the ongoing research if you understand what I mean wink Awaiting you code contribution and hoping you speak a different language.

@Beaf: I quite agree with you. Concurrency issues seem to be very subtle. Another interesting observation is that concurrency was necessitated by the increasing demand for distributed computing which implied concurrent requests to your programs so initially some languages did not take this into consideration in their design and so solutions to these concurrency problems seems to be an afterthought as you can quite clearly see from Seun's post. What's even more interesting is that most of these new languages took these problems into consideration in their design
Re: What Is Concurrency And How Does Your Language Tackle It? by Fayimora(m): 5:20am On Mar 16, 2012
Also, Concurrency is HARD! "Anyone that says its easy doesn't know what they are talking about!"
Re: What Is Concurrency And How Does Your Language Tackle It? by worldbest(m): 3:54pm On Mar 16, 2012
Yeah. Concurrency is hard. However, Java makes it easier for me. I hate pythons concurrency capabilities. Stupid GIL.
Re: What Is Concurrency And How Does Your Language Tackle It? by Ghenghis(m): 11:35am On Mar 20, 2012
Yeah, its hard and its consequences are unavoidable whether a programmer is aware of them or not.

Concurrency prior to now didn't seem to gel with Object Oriented Programming; hence lots of programmers don't think of their solutions in terms of IO cycle/ CPU cycle/ another thread of execution etc. Which was sorta right ... but these days even if you don't explicitly use concurrency, your APIs do, so its best to be very aware of how to write concurrent programs.

1 Like

Re: What Is Concurrency And How Does Your Language Tackle It? by candylips(m): 10:24am On Mar 22, 2012
worldbest: Yeah. Concurrency is hard. However, Java makes it easier for me. I hate pythons concurrency capabilities. Stupid GIL.

concurrency is not that easy in java either although a new higher level of concurrent abstraction was added to java 5 it is still bloody difficult in non trivial apps.
Re: What Is Concurrency And How Does Your Language Tackle It? by megaplaza(m): 2:18pm On Mar 23, 2012
i heard and have seen examples in Scala and Erlang, both are functional programming languages, that handles concurrency with few lines of code using Actor model. Good new is Scala interoperate with java and compiles to JVM bytecode i.e java classes. Check out Scala concurrency examples on google,

1 Like

Re: What Is Concurrency And How Does Your Language Tackle It? by Seun(m): 2:42pm On Mar 23, 2012
Can you be more specific about the concurrency problem you're trying to solve?
New Nairaland uses DB transactions for concurrency, and it works well and scales nicely, too.
Re: What Is Concurrency And How Does Your Language Tackle It? by worldbest(m): 9:13pm On Mar 23, 2012
candylips:

concurrency is not that easy in java either although a new higher level of concurrent abstraction was added to java 5 it is still bloody difficult in non trivial apps.


Well. I am working on an enterprise project that involves intelligent use of concurrency. I haven't been struggling that much as I would if I was working with python. I don't think concurrency in Java is bloody difficult though.

(1) (Reply)

Figure Out The Error Please (PHP And Mysql)!!! / Nigerians And C# / Cookie Programming In Javascript

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 19
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.