Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Web Worker



  Demo on creating worker pool in GoLang

A worker pool is a pool where a specified number of workers(usually goroutine) created and run to pick up tasks. This can allow multiple tasks to be ran at the same time while keeping the number of workers a fixed number to avoid overuse of resource in the program. There are usually two approaches of creating worker pool. One is with fixed number of workers pre-created One is creating worker when needed until the max number of workers created In this post, we will cover the demonstration of cr...

   WORKER POOL,GOLANG,GOROUTINE     2021-01-24 05:04:00

  Different ways of handling concurrent job in GoLang

GoLang provides very good support of concurrency and the way to make some code to run concurrent is pretty simple and straightforward. Adding a simple go before a normal function call will make the function call asynchronous. In real cases normally people would concurrently run some jobs to improve the speed and efficiency. One important part of running jobs concurrently is about aggregating results so that the consequent function call would be able to proceed. There are multiple ways handling t...

   COMPARISON,WORKER POOL,WAITGROUP,CONCURRENT     2021-05-15 11:13:53

  Go channel explained

In Go, a channel is a type of concurrent data structure that allows two or more goroutines (Go's term for lightweight threads) to communicate with each other. Channels provide a way for goroutines to send and receive values, and they are an essential part of Go's concurrency model. Here's a simple example that demonstrates how to use channels in Go: package main import ( "fmt" ) func main() { // Create a new channel with the `make` function ch := make(chan int) // Start a new ...

   GOLANG,CHANNEL     2022-12-10 22:24:26

  HTML5 Web Worker

Web Worker is a JavaScript multithreading solution provided by HTML5. we can put some compute intensive codes into Web Worker and it will not hang the user interface. 1. How to use Web Worker Web Worker's basic mechanism is to use Worker to load a JavaScript file to create a new thread in JavaScript's main thread. It will not block other thread's execution and will provide a data exchange interface between main thread and new thread : postMessage() and onmessage. Let's look at an example: //work...

   JavaScript,HTML,Web Worker     2012-12-02 06:25:00

  Mastering Go Channels: How to Build Concurrent Applications Like a Pro

Introduction In the world of concurrent programming, Go channels have quickly become a popular tool for building fast and efficient applications. Utilizing channels can help you take full advantage of the power of Go's lightweight threads, or goroutines, and enable you to easily and effectively manage data sharing and synchronization. In this article, we'll dive deep into the world of Go channels and show you how to build concurrent applications like a pro. Understanding Go Channels To start, le...

   GOLANG,CHANNEL,CONCURRENCY     2023-04-21 14:47:47

  Java Concurrency Basics: CountDownLatch and CyclicBarrier

CountDownLatch CountDownLatch can be used in synchronizing behavior among threads, it makes one or more threads wait for some actions in other threads to be completed. It has a property count which defines how many countDown() need to be called before other threads which called await() to be waked up.  When a thread calls CountDownLatch.await(), the thread will be blocked until the value of count becomes 0. The initial value of count can be specified when creating the CountDownLatch instanc...

   JAVA,JAVA CONCURRENCY,COUNTDOWNLATCH,CYCLICBARRIER     2018-03-25 07:02:40

  Simple explanation about process and thread

Process and thread are two basic concepts of operating system, but they are a bit abstract which cannot be  mastered easily. There is an analogy which explains these concepts very well. 1. The kernel of the computer is CPU, it handles all the computing tasks, it's like a factory and will run all the time. 2. Assume there is power limitation for the factory, it can only supply to one unit once,i.e, when one unit is working, other units must stop and wait. The meaning behind this is that eac...

   Process,Thread,CPU,Operating system     2013-04-24 11:33:10

  Microsoft Interview Riddle Questions

Every year, many people will send their resume to Microsoft and Google. So how do these IT companies hire people? What kind of interview questions will they ask. Let's see what Microsoft asked before in this article. These questions are more focusing on how you are reasoning, not necessary your technical skills. 1.  You’ve got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at...

   Microsoft,Interview question,Riddle questions,Answer     2012-03-10 04:56:48

  Python threads: communication and stopping

A very common doubt developers new to Python have is how to use its threads correctly. Specifically, a large amount of questions on StackOverflow show that people struggle most with two aspects: How to stop / kill a threadHow to safely pass data to a thread and back I already have a blog post touching on these issues right here, but I feel it’s too task-specific for sockets, and a more basic and general post would be appropriate. I assume the reader has a basic familiarity with Pytho...

   Python,Multithreading,Communication,Synchronize     2011-12-28 07:38:32

  6 Great Ways to Design Amazing PWA’s

Why PWA v/s Native Mobile apps a wrong question to ask. PWA has already gathered a lot of momentum recently and is structured to give “App like” experience to its user base. Reveal all the extra layers underneath and create magic with brand new ideas to design progressive web apps. What comes to your mind when you imagine leading a progressive life? Definitely, it is going to be far better than  the previous one. Progressive Web Apps (PWA’s) are going to work to outweigh ...

   WEB DESIGN,PROGRESSIVE WEB APPS,PROGRESSIVE WEB APP TECHNOLOGY,COMMON UI/UX MISTAKES     2018-02-28 03:30:46