Page 1 of 2 12 LastLast
Results 1 to 20 of 26
Like Tree1Likes

Thread: "Asynchronous tasks" - what does it mean?

  1. #1
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default "Asynchronous tasks" - what does it mean?

    I am reading a tutorial about creating threads, and it says that we can directly control thread creation and management by simply instantiating Thread whenever the application needs to start an asynchronous task.

    What exactly is an asynchronous task. It will be better if somebody can give me a simple example of asynchronous task(s).

    I did try to Google it but I found different definitions.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,732
    Blog Entries
    7
    Rep Power
    21

    Default Re: "Asynchronous tasks" - what does it mean?

    Suppose you have two computers, each running their own program. Those programs run asynchronously. It's he same with multiple threads: they run, minding their own business, no matter what the other threads do.

    kind regards,

    Jos
    Zarah likes this.
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    @JosAH Thank you very much!

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,732
    Blog Entries
    7
    Rep Power
    21

    Default Re: "Asynchronous tasks" - what does it mean?

    You're welcome of course; asynchronous threads are easy: just let them run and let them do what they have to do; trouble comes when you have to syncrhonize those threads; i.e. if two or more threads want to access a shared resource (a file or even a simple int variable); they have to wait and take turns; Java has many facilities to accomplish the conduct of those threads, the synchronized keyword, wait and notify (all) and an entire package full of classes: java.util.concurrent.*

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    asynchronous threads are easy: just let them run and let them do what they have to do; trouble comes when you have to synchronize those threads
    Cool. I have just begun a beginners' tutorial about threads. I am just reading it and trying to practice. I think I have to just take in what they are telling me, and wait (for learning how to synchronize threads) until I need to synchronize some threads. Thank you.

  6. #6
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: "Asynchronous tasks" - what does it mean?

    Threading is a fun topic, they make for fun exercises that can teach you a lot about the wonderful world of computing and processes.

    They're also the source of a world of hurt when you don't apply it properly and you create a deadlock situation / a race condition. Then you can expect hair loss and a caffeine overdose. But that is a subject for when you have really dug yourself into the subject material, I would keep your adventures into the world of threading a bit shallow right now to not overload yourself. Some simple synchronization exercises and to learn to apply some classes in the concurrency API should be enough to get you going.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    Threading is a fun topic, they make for fun exercises that can teach you a lot about the wonderful world of computing and processes.

    They're also the source of a world of hurt when you don't apply it properly and you create a deadlock situation / a race condition. Then you can expect hair loss and a caffeine overdose. But that is a subject for when you have really dug yourself into the subject material, I would keep your adventures into the world of threading a bit shallow right now to not overload yourself. Some simple synchronization exercises and to learn to apply some classes in the concurrency API should be enough to get you going.
    Yeah alright. Thank you for your advice. Infact I myself plan to finish this tutorial to get the basic concepts, and then this for understanding the concept of processes and threads in android, and then I'll use threads and Asynctasks etc. in my small android application.

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,732
    Blog Entries
    7
    Rep Power
    21

    Default Re: "Asynchronous tasks" - what does it mean?

    Quote Originally Posted by gimbal2 View Post
    Then you can expect hair loss and a caffeine overdose.
    I don't suffer from hair loss, but what is wrong with a caffeine overdose?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: "Asynchronous tasks" - what does it mean?

    Did I say or imply there was something wrong with it? I was merely stating expected consequences.

    All of a sudden in the last post new information was added: this is about Android and not about Java. I wonder if the Android API even has the concurrency classes I earlier mentioned.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  10. #10
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    All of a sudden in the last post new information was added: this is about Android and not about Java. I wonder if the Android API even has the concurrency classes I earlier mentioned.
    No, this is NOT about android. You said that some simple synchronization exercises and learning to use some classes in the concurrency exercises will be enough to get going, and I said yes, I just want to understand the basics of threads in java, just to form the foundation for learning the basics of processes and threads in android, because I have to apply them in my application.
    Last edited by Zarah; 03-19-2014 at 02:13 PM.

  11. #11
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: "Asynchronous tasks" - what does it mean?

    Whoops, my mistake. Well I'll try to weasel out of my assumptions: do realize the Android API is not the same as the Java API, so what you learn in one might not translate to the other ;) You may have already known that, in which case I'll just go stand in the corner in shame.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  12. #12
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    Yes, the android API is different from java API, I had started reading something about the processes and threads in java (without knowing how you even create a thread in java) and a simple example of creating a thread got me perplexed. Then they had those strange things like Asynctasks, Handlers, Messages, Loop etc.
    So I decided to get myself clear in java first.
    I think android is based on java, and I always have to get back to java in order to understand anything in android. If I had plenty of time and if i had decided to pursue programming for life, I would learn java first, develop something in java, then use my knowledge as a foundation for learning android. I might be wrong in the approach but I can be wronf I am just a beginner.

  13. #13
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: "Asynchronous tasks" - what does it mean?

    It is not based on Java - it only reuses the Java language and that is a huge source of confusion for many programmers; When you speak about "Java" you speak about the platform; the runtime, the virtual machine, the tools and the set of languages that are supported by the platform; one such language is confusingly called "Java" too because that was the first, but nowadays there are a whole host of languages and more are added each year. Groovy, Scala, Ceylon, etc. etc.

    Google uses the Java -language- only and parts of the standard API, but most of what you'll get into contact with is entirely different. But to learn the language and programming theory in general you are perfectly fine the way you are progressing right now and will serve as a very easy bridge to getting into Android programming.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  14. #14
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    It is not based on Java - it only reuses the Java language and that is a huge source of confusion for many programmers; When you speak about "Java" you speak about the platform; the runtime, the virtual machine, the tools and the set of languages that are supported by the platform; one such language is confusingly called "Java" too because that was the first, but nowadays there are a whole host of languages and more are added each year. Groovy, Scala, Ceylon, etc. etc.

    Google uses the Java -language- only and parts of the standard API, but most of what you'll get into contact with is entirely different.
    Oh really that's valuable, thank you, because nobody ever told me that, and I did not know that!

    But to learn the language and programming theory in general you are perfectly fine the way you are progressing right now and will serve as a very easy bridge to getting into Android programming.
    Thanks and I hope so..

  15. #15
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: "Asynchronous tasks" - what does it mean?

    Phew, I redeemed myself.

    I'll just share my biggest problem with Android programming as a long time Java developer - the friggin' screen dimensions. I was so happy that monitors started to have higher and higher resolutions so I could fit more onto it, and now it goes the other way around again; you have to do more with less. I'm not trained to think from that perspective, so its more the actually application DESIGN that is troublesome for me than the programming work involved. Android programming is well documented so the technical side really isn't the issue.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  16. #16
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,816
    Rep Power
    25

    Default Re: "Asynchronous tasks" - what does it mean?

    the actually application DESIGN that is troublesome
    Not only that, there are now many more ways for user actions. The mouse was so simple. Now there are many, many ways to touch a screen.
    If you don't understand my response, don't ignore it, ask a question.

  17. #17
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    For me, at the moment, when I switch to Android from Java programming language (and vice versa), it is difficult to take in that there is no main() in android and the control starts from the start of the page, and then in java the programmer calls other methods (starting from main() ) but in Android, the system/Delvik machine/whatever calls the life-cycle callback methods in response to what the user does, I hope i will get OK with the differences in some time.
    Regarding the design, I am not there yet so the only thing I know is that I like the colorful and good-looking android applications out there, that was one of the reasons I decided to learn Android app development.

  18. #18
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: "Asynchronous tasks" - what does it mean?

    Quote Originally Posted by Norm View Post
    Not only that, there are now many more ways for user actions. The mouse was so simple. Now there are many, many ways to touch a screen.
    Ha, someone to share my woes with. Does that hinder you from trying to seriously get into Android programming? For me it really does, and that is a problem for me because that's quickly becoming a standard job requirement, to be able to do target mobile platforms too. That and throwing Javascript at everything, it just conflicts with my long-term conditioning to avoid it because its evil.

    Quote Originally Posted by Zarah View Post
    Regarding the design, I am not there yet so the only thing I know is that I like the colorful and good-looking android applications out there, that was one of the reasons I decided to learn Android app development.
    Ok but they don't just look like that by throwing code at it, application design is a skill on its own. You can also create pretty looking PC applications if you have the skills. It might help to also dip into web development to get a feel for how that kind of thing works.
    Last edited by gimbal2; 03-19-2014 at 04:10 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  19. #19
    Zarah is offline Senior Member
    Join Date
    Mar 2014
    Posts
    118
    Rep Power
    0

    Default Re: "Asynchronous tasks" - what does it mean?

    I will like to ask something here although it might be irrelevant and my apologies for that. Somebody once told me that there are applications which run on different operating systems, e.g. Google, Facebook etc. has the same app running on an Android device and an iPhone as well. But I could not find any clue about it.

    I have been wondering if it is the same app, coded just once, and is compatible with Android and iOS? Or they developed different apps and somehow coordinated them? Or they are essentially and entirely different apps for different operating systems and they just perform the same functions?

  20. #20
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: "Asynchronous tasks" - what does it mean?

    I'm pretty sure they are different apps and even developed by different teams of people. Perhaps there are some tools to abstract away the differences between Android, iOS and Windows Mobile, but that is probably not as far advanced as Java on PCs.

    The only true answer there is to don't make it an app but a webapp; then you run in the pretty much standardized web browser environment and that way you can target any platform you want with the exact same application. Webapps tend to generate overhead in data however, so people like to build native apps to make it slightly less data heavy and more responsive.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 12-07-2012, 09:29 AM
  2. Replies: 3
    Last Post: 10-30-2012, 04:06 PM
  3. Replies: 1
    Last Post: 02-01-2012, 09:37 PM
  4. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  5. Replies: 1
    Last Post: 10-20-2008, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •