Open zhamri opened 4 years ago
256750
What is Concurrent Programming?
a) What is concurrent? Describe things that are occurring, or people who are doing something, at the same time, such as "concurrent users" of a computer program.
b) What is concurrent programming/computing?
In a concurrent program, several streams of operations may execute concurrently. Each stream
of operations executes as it would in a sequential program except for the fact that streams can
communicate and interfere with one another.
c) Concurrency vs Parallelism Concurrency is a task start, run, and complete in overlapping time periods. Parallelism is a tasks run simultaneously.
Concurrency can seem broken, counter intuitive, paradoxical despite the rules
Matric Number : 255312
Link of The Video : https://www.youtube.com/watch?v=ltTQaMSk6ME
Title of the video : Concurrency vs Parallelism : Difference between them with examples & Comparison Chart
Summarize what you have learned from the video: This video tutorial explains about the concept of concurrency and parallelism used in the operating system, the difference between them using the comparison chart along with the suitable example. Parallelly executing processes must be concurrent unless they are operated at the same instant but concurrently executing processes could never be parallel because these are not processed at the same instant.
256599
Thread Safety in Java (Youtube)
Mutation and Immutability Mutation means we can change the variable meanwhile immutability can't. We just cannot change the variable when assigned. So, mutation is better than immutability.
Synchronized Keyword By using this keyword, it will be calling by one thread. Means that, Thread 1 will process and Thread 2 has to wait.
public synchronized void increment()
{
count++;
}
Thread Safety The meaning of thread safety is that the method will be executed only by one thread and not both.
250634
55 NewThings in Java 7 - Concurrency
to manage a number of tasks whose intermingling will make more efficient use of the computer (including the ability to transparently distribute the tasks across multiple CPUs), allow better code organization, or be more convenient for the user.
Overall, the scenario of the video has explained these 3 states perfectly.
1) 259187
2) https://www.youtube.com/watch?v=FChZP09Ba4E
3) Concurrency vs Parallelism
4) Summarize what you have learned from the video
Parallelism allows multiple tasks to run on different cores. To enable parallelism in java, we can use Threads or Threadpool but we had to ensure that our CPU has more than one core so that we can run multiple cores. Concurrency only use one core. It may lead to error if it doesn't has "lock" command. "Concurrency is about dealing with lot of things at once."
1.243147
2.https://www.youtube.com/watch?v=FChZP09Ba4E&list=PLhfHPmPYPPRk6yMrcbfafFGSbE2EPK_A6&index=1
3.Concurrency vs Parallelism
4.a)Concurrency is about dealing with lot of things at once.
b) Shared resource is to be accessed/updated or multiple tasks need to coordinate
c)Tools to deal with concurrency: Locks/synchronized Atomic classes Concurrent data structures completableFuture CountdownLatch/Phaser/CyclicBarrier/Semaphore etc.
d)Concurrency + Parallelism Split the sequential flow into independent components Use threads/thread-pools to parallelism (& thus speed up) Whenever share resource is to be updated, use concurrency tools to manage state Whenever independent components (running on threads) need to coordinate, use concurrency tools
252709 Video Link: https://www.youtube.com/watch?v=Xj1uYKa8rIw Video Title: 13.2 Multi threading in Java Practical Lesson Learned: What I learn is how to use thread and what the necessary to use them. I also learned how to control the behavior of the thread by using sleep and causing delay in between thread start() in order to make the thread execute accordingly to our desire.
Matric number 250615
Link of the video https://www.youtube.com/watch?v=QVeHgraetEA
Title of the video The Java Fork-Join Pool Framework
Summarize what you have learned from the video
computation model of fork-join pool - provides a high performance, parallel, fine-grained task
execution framework for Java programs.
the goal of ForkJoinPool is to maximize processor core utilization
two key methods in ForkJoinTask
1. Matric number 254251
2. Link of the video https://www.youtube.com/watch?v=TCd8QIS-2KI
3. Title of the video Java Threads Tutorial
4.Summarize what you have learned from the video This video is explaining the basic about thread. It gives detailed explanation about how to create thread and work with multiple thread.
1.Matric number:251230
2.Link of the video:https://www.youtube.com/watch?v=fbpEs51JfdU
3.Title of the video:Concurrency and Parallel Programming in Java
4.Summarize what you have learned from the video --Concurrency happens when multiple copies of the same program are run at the same time, but in the course of their execution, those copies communicate with each other. In many simple concurrent applications, you use a single machine, and the program’s instruction code is only loaded into memory once—in other words, a single process is created—but the process’s execution has multiple threads. Each thread remembers which instruction it’s on, and executes that instruction before going on to the next one; thus, the various threads in a process each follow their own control flow, but can make decisions based on information they receive from other threads.
Parallelism is when multiple copies of the same program are run at the same time, but on different data, and not necessarily on the same machine. For example, a search engine company would use a large number of machines to crawl the web, and each of those machines would be running a program that sends requests out to websites, but each copy of the program is given a different list of URLs, and will therefore produce a different set of downloaded content. You could say that all the copies of the program run “in parallel”, so they will get the job done faster than if there was just one machine that would go through the entire list of URLs, one at a time. When you use parallelism, you can refer to each copy of the program as one “instance” or one “replica”.
1.Matric number: 246210
Link of the video: https://www.youtube.com/watch?v=b5sj13Z7aho
Title of the video: Java Threads Tutorial 1 - Introduction to Java Threads
Summarize what you have learned from the video:
Difference multitasking and multithreading is multitasking refers to a computer’s ability to peform multi jobs concurrently and multithreading refers to multiple threads of controls within single program. Difference between concurrency and parallelism . If consider have one cpu and want to run two browser, cpu will allocate priority to the processes and this is concurrency and if have two cpu and each process will run each processer in call parallelism. An executing instance of a program is called a process. A thread is a subset of the process. Threads share the address space of the process that created it; processes have their own space. The purpose of threads is to maintain responsiveness of an application during a long time running task. To enable cancellation of separable tasks. Some problems are instrinsically parallel. When we execute an application. The JVM creates a thread object whose task is defined by the main () method. There are two ways in creating thread object is by subclassing the Thread class ans instantiating a new object of the class and implementing the Runnable interface.
247991
Java Concurrency Interview Question: How to timeout a thread?
This video show how to stop a particular thread and how to do it after a certain time out we want to able to stop that particular task. This video also show how to use interrupts, volatiles or AtomicBooleans to stop the thread and Thread.sleep or Schedulers for conditional timeouts.
if we execute the method shutdown() or shutdownNow() does it stop the thread?
shutdown() -not accept any new tasks -whatever previously submitted tasks are there in the queue which are not executed it executes them
shutdownNow() -no new tasks accepted -previously submitted task waiting in the queue are returned -tasks being run by the thread(s) are attempted to stop
Matric number 259296
Link of the video https://www.youtube.com/watch?v=TCd8QIS-2KI
Title of the video Java Threads Tutorial | Multithreading In Java Tutorial | Java Tutorial For Beginners | Edureka
Summarize what you have learned from the video From this video I learned java Life cycle have New, Runnable, Running, Waiting, Terminated. How to creating a thread, What is Main Thread, Multi-Threading and Thread Pool.
Java synchronnization is to access of multiple threads which are trying to access the common shared resources but it produce problem.
If don't implement synchronization, problem occurs:
When process is created, separate memory location is created,it need to create in registries, whenever a context switch between one process to another process it happens, it needs to save the current state of in a thread and then current state up in the process and then we switch to the new process
Java synchronization apply into 3 levels:
Advantages of synchronization: -maintain the consistency between memory consistency and will stop the interpreting the thread with another thread.
Understand the meaning of Parallelism: Parallelism is a form of computing that parititions task into sub-task can run independently& whose partial result are combined.
Brief history of concurrency: -Foundational concurrency support -Advanced concurrency support -Foundational parallelism support(focus on data parallelism that runs the same task on different data elemenst)
1.Matric number = 255227 2.Link of the video = https://www.youtube.com/watch?v=L95658yXRgI 3.Title of the video = MultiThreading in Java Theory 4.Summarize what you have learned from the video The video explains what is multithreading and the example. The video also explain uses of threads such as using a complete power of CPU, Asynctask in Android, creating web application and gaming.
1) matric no :255403 2) https://www.youtube.com/watch?v=rzjtuzmU948 3) thread states
4) know how thread life cycle from runnable,sleping time wait, waiting,dead state and blocked i/d synchronized
Concurrency is the composition of independently executing processes, while parallelism is the simultaneous execution of (possibly related) computations.
Concurrency is about dealing with lots of things at once. Parallelism is about doing lots of things at once.
An application can be concurrent – but not parallel, which means that it processes more than one task at the same time, but no two tasks are executing at same time instant.
An application can be parallel – but not concurrent, which means that it processes multiple sub-tasks of a task in multi-core CPU at same time.
An application can be neither parallel – nor concurrent, which means that it processes all tasks one at a time, sequentially.
An application can be both parallel – and concurrent, which means that it processes multiple tasks concurrently in multi-core CPU at same time .
That’s all about Concurrency vs. Parallelism, a very important concept in java multi-threading concepts.
Instruction
Find and watch a good youtube video on any concurrency topics. The link below will guide you on how to identify the topic
https://github.com/zhamri/MyClass-STIW3054/wiki
Submission