1.3.4 design concurrent and friendly applications and 1.3.4 concurrent applications

Source: Internet
Author: User

1.3.4 design concurrent and friendly applications and 1.3.4 concurrent applications

1.3.4 design concurrent and friendly applications

 

When using traditional command styles to Write multi-threaded applications, we have to deal with two problems:

■ It is difficult to convert the existing sequential code into parallel code, because to explicitly use the thread, you must modify most of the basic code.

■ It is difficult to use the shared status and lock. You must carefully consider how to use locks to avoid contention conditions and deadlocks, leaving enough space for parallel execution.

Function programming gives us the answer:

■ When using the Declarative Programming style, you can introduce parallelism in the existing code. With a few elements, you can combine commands with commands executed in parallel.

■ Because of its immutability, it is impossible to introduce contention conditions. You can write code that does not need to be locked. As long as you see which part of the program is independent, you can immediately change it to a parallel running task.

These two aspects can affect how we design applications, and make full use of multi-core machines by making it easier to write code that runs in parallel. However, writing immutable code is not just about getting merged rows. There is still some tricky work to do, but functional programming can minimize the extra effort spent on parallelization.

It's not over yet. When I start to think in the form of functions, I will find other changes in the design ......


Design and implement the Program for concurrent Linux processes-Audio and Video Synchronization

Master! A whimsical new video format will be created by you.
Come on, master of the postgraduate entrance exam. Don't try to copy or get it without any effort.
Please take a closer look at the MPEG standard (Moving Pictures Experts Group/Motin Pictures Experts Group), MPEG-1, MPEG-2, MPEG-4, MPEG-7 and MPEG-21, dedicated to setting up video and audio standards, the members are technical experts in the video, audio, and system fields.
These experts outside China are not fake names, and your program is not able to deal with the same code as one or two pieces of bean curd blocks.
If you want to implement the simplest parent-child process synchronization program, please study the PV operation and lock mechanism carefully.
If you want to develop graphical programming, you may need to study the GUI programming mechanism.
If you want to program videos, you need to study the compression and decompression mechanisms of audio and video.
You can only make the software that you want when you get through these things.
There are too many. If you don't talk about it, the University is now a master of plagiarism.

Design and implement concurrent Linux processes-Audio and Video Synchronization

You only need to get the current playback time,
For example, a song is four minutes. When you play it for a few minutes, you will be able to display What You Want to play. That is to say, you can play it now.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.