What is the SSL Certificate Chain?

https://support.dnsimple.com/articles/what-is-ssl-certificate-chain/

https://knowledge.digicert.com/solution/SO16297.html

https://blog.instantssl.com/ssl-certificate/ssl-certificate-chain-explained/

Advertisements

How can a single core processor run multiple tasks at once?

If you are reading this article then may be you are looking for some answers of questions like below-

  • How can a single core processor run multiple tasks at once?
  • How does multi-threading work in a single-core computer?
  • How does a single thread run on multiple cores?
  • Can a single core of a CPU process more than one process?
  • Multiple CPUs, Cores, and Hyper-Threading, Multitasking, Multiprocessing etc…

Or, If a computer having single core processor can run only one task at a time then how we are able to do multiple things like editing documents, hearing music, scanning computer etc… simultaneously without any interruption?

On a single-processor multitasking system, multiple processes don’t actually run at the same time since there’s only one processor. Instead, the processor switches among the processes that are active at any given time. Because computers are so fast compared with people, it appears to the user as though the computer is executing all of the tasks at once.

multitask20on20single20core_550

Multitasking on a multiple-processor system still involves the processors switching between tasks because there are almost always more tasks to run than there are processors. Note, however, that there can be as many tasks running simultaneously as there are processors in the system. Multitasking OSs can truly execute multiple tasks concurrently. The multiple computing engines work independently on different tasks.

multitask20on20multiple20cores_550

So to make a single core able to run multiple threads, a form of time-division multiplexing was used. To simplify things a bit: the OS sets up a timer which interrupts the system at a fixed interval. A single interval is known as a time slice. Everytime this interrupt occurs, the OS runs the scheduling routine, which picks the next thread that is due to be executed. The context of the core is then switched from the currently running thread to the new thread, and execution continues.

Since these timeslices are usually very short, as a user you generally don’t even notice the switches. For example, if you play an mp3 file, the CPU has to decode the audio in small blocks, and send them to the sound card. The sound card will signal when it is done playing, and this will trigger the mp3 player to load new blocks from the mp3 file, decode them, and send them to the sound card. However, even a single-core CPU has no problem playing an mp3 in the background while you continue work in other applications. Your music will not skip, and your applications will run about as well as when no music is playing. On a modern system that is no surprise, as playing an mp3 takes < 1% CPU time, so its impact is negligible.

Multitasking :  A task generally refers to a single application/process. So multitasking means you are using multiple applications at the same time. Multitasking contrasts with single-tasking, where one process must entirely finish before another can begin. MS-DOS is primarily a single-tasking environment, while Windows XP or later OS are multi-tasking environments.

So, Multitasking refers to the ability of the OS to quickly switch between each computing task to give the impression the different applications are executing multiple actions simultaneously.

Multithreading: Multithreading extends the idea of multitasking into applications, so you can subdivide specific operations within a single application into individual threads. Each of the threads can run in parallel. The OS divides processing time not only among different applications, but also among each thread within an application. Multithreading provides a way to have more than one thread executing in the same process while allowing every thread access to the same memory address space. This allows very fast communication among threads.

Hyper-Threading: A single physical CPU core with hyper-threading appears as two logical CPUs to an operating system. The CPU is still a single CPU, so it’s a little bit of a cheat. While the operating system sees two CPUs for each core, the actual CPU hardware only has a single set of execution resources for each core. In other words, the operating system is tricked into seeing two CPUs for each actual CPU core. Hyper-threading allows the two logical CPU cores to share physical execution resources. This can speed things up somewhat—if one virtual CPU is stalled and waiting, the other virtual CPU can borrow its execution resources. Hyper-threading can help speed your system up, but it’s nowhere near as good as having actual additional cores.

Multiple Cores: Originally, CPUs had a single core. That meant the physical CPU had a single central processing unit on it. To increase performance, manufacturers add additional “cores,” or central processing units. A dual-core CPU has two central processing units, so it appears to the operating system as two CPUs. A CPU with two cores, for example, could run two different processes at the same time. This speeds up your system, because your computer can do multiple things at once.

cores

Unlike hyper-threading, there are no tricks here — a dual-core CPU literally has two central processing units on the CPU chip. A quad-core CPU has four central processing units, an octa-core CPU has eight central processing units, and so on.

Multiple CPUs: Systems with multiple CPUs aren’t very common among home-user PCs today. Even a high-powered gaming desktop with multiple graphics cards will generally only have a single CPU. You’ll find multiple CPU systems among supercomputers, servers, and similar high-end systems that need as much number-crunching power as they can get.

 

References-

https://technet.microsoft.com/en-us/library/cc767883.aspx

https://scalibq.wordpress.com/2012/06/01/multi-core-and-multi-threading/

https://www.howtogeek.com/194756/cpu-basics-multiple-cpus-cores-and-hyper-threading-explained/

 

Node.js Console (R.E.P.L)

Node.js comes with virtual environment called REPL (aka Node shell). The repl module provides a Read-Eval-Print-Loop implementation that is available both as a standalone program or includible in other applications. It can be accessed using: const repl = require(‘repl’);  It is a quick and easy way to test simple Node.js/JavaScript code.

  • R(Read) : Reads user’s input, parses the input into JavaScript data-structure, and stores in memory
  • E(Eval) : Takes and evaluates the data structure.
  • P(Print) : Prints the result.
  • L(Loop) : Loops the above command until the user presses ctrl-c twice

To launch the REPL (Node shell), open command prompt (in Windows) or terminal (in Mac or UNIX/Linux) and type node as shown below. It will change the prompt to > in Windows and MAC-

nodejs1.PNG

You can execute an external JavaScript file by writing node fileName command.

nodejs2.PNG

Please visit to https://nodejs.org/api/repl.html#repl_repl for more and deep info 🙂

Programming is Easy…

How to convert image to black and white using CSS ?

Using CSS filter property we can easily apply the graphical effects like blurring or color shifting to an element. Filters are commonly used to adjust the rendering of images, backgrounds, and borders. Below are some common graphical effects-

  • Blur
  • Brightness
  • Contrast
  • Drop Shadow
  • Grayscale
  • Hue Rotation
  • Invert etc…

grauscale

img {
-webkit-filter: grayscale(100%); /* Safari 6.0 - 9.0 */
filter: grayscale(100%);
}

https://www.w3schools.com/cssref/css3_pr_filter.asp

https://developer.mozilla.org/en-US/docs/Web/CSS/filter

Programming is Easy…

 

JavaScript Modules : Quick Overview

As now most of the web application frameworks uses the modules so lets have a quick introduction what exactly is a module.

What is Module?:

Someone said- Good authors divide their books into chapters and sections; good programmers divide their programs into modules.

  • In JavaScript, the word “modules” refers to small units of independent, reusable code.  JavaScript modules export a value, rather than define a type. In practice, most JavaScript modules export an object literal, a function, or a constructor
  • Modules are highly self-contained with distinct functionality, allowing them to be shuffled, removed, or added as necessary, without disrupting the system as a whole
  • It is an object or collection of objects which can contain lots of logic inside it usually defined in its own file or a separate file.

For code implementations please visit to below links-

https://toddmotto.com/mastering-the-module-pattern/

https://www.codeproject.com/Articles/247241/Javascript-Module-Pattern

How to reset and sync local git repository with remote branch?

If you are looking a command to destroy/reset any local changes in your current git repository then below are the steps for you –

Remember to replace origin and master with the remote and branch that you want to synchronize with.

Command –

> git fetch origin && git reset –hard origin/master && git clean -f -d

Or step-by-step-

> git fetch origin
> git reset –hard origin/master
> git clean -f -d

Your local branch is now an exact copy (commits and all) of the remote branch.

We can also add these as an alias in .gitconfig file –

[alias]
resetorigin = !git fetch origin && git reset –hard origin/master && git clean -f -d

Then we can type –

> git resetorigin

Programming is easy…