Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 43bbdd5

Browse files
adding three q and a
1 parent e15dffc commit 43bbdd5

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

‎README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,57 @@
14301430
**[ Back to Top ⬆ ](#table-of-contents---golang)**
14311431

14321432

1433+
13. ### What are concurrency and parralism and what is the difference between both?
1434+
1435+
**Concurrency** :
1436+
Defination 1 : Dealing with multiple things at once. <br/>
1437+
Defination 2 : A Composition of independently executing processes(Example: suppose there are two tasks A and B , the way this work is A task done 70% meanwhile it has to wait for something , so it picks up task B and try to complete if suppose B task has to wait at 60% , for something then it picks up A task them completes it and comes back to B )
1438+
1439+
**Parralism** :
1440+
Defination 1 : Parallelism is about doing lots of things at once. <br/>
1441+
Defination 2 : It is the simultaneous execution of (possibly related) computations. (Example: suppose there are two tasks A and B , it takes both tasks and try to complete both together )
1442+
1443+
![cocurrency_parllel](/img/cocurrency_parllel.jpg)
1444+
1445+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1446+
1447+
14. ### What are the difference between goroutines and threads?
1448+
**Threads** : A thread is just a sequence of instructions that can be executed independently by a processor. Threads use a lot of memory due to their large stack and requires call to OS for resources (such as memory) which is slow. so doesn’t always guarantee a better performance than processes in this multi-core processor world.
1449+
1450+
**Goroutines**:Goroutines exists only in the virtual space of go runtime and not in the OS. and A goroutine is created with initial only 2KB of stack size. Each function in go already has a check if more stack is needed or not and the stack can be copied to another region in memory with twice the original size. This makes goroutine very light on resources.
1451+
1452+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1453+
1454+
15. ### What are channels for?
1455+
1456+
Channels are the pipes that connect concurrent goroutines. You can send values into channels from one goroutine and receive those values into another goroutine.
1457+
1458+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1459+
1460+
16. ### Can you do something in goroutines without channels?
1461+
1462+
1463+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1464+
1465+
17. ### What is a Closure?
1466+
1467+
1468+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1469+
1470+
18. ### What are runtime and runtime packages?
1471+
1472+
1473+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1474+
1475+
19. ### How can you get how many cores your computer has?
1476+
1477+
1478+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
1479+
1480+
20. ### How would you tell a goroutine to use less core than what you have?
1481+
1482+
1483+
**[ Back to Top ⬆ ](#table-of-contents---golang)**
14331484

14341485

14351486
### Table of Contents - Database Engineering

‎img/cocurrency_parllel.jpg

14 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /