This is a test / interview implementation, written in go

Go GitHub go.mod Go version of a Go module Maintenance Docker

Factorizer

This is a test / interview implementation, written in go. Author's kinda first go project. Just move on.


Számok Faktorializálása

A faktorizálás egyszerre több magon zajlik, az eredmények sorrendben érkeznek vissza. A faktorizáló viselkedése több ponton is befolyásolható, pl teszteléshez. A kiszámolandó számokat véletlenszerűen generáljuk, és az eredményeket alapértelmezés szerint kiírjuk az alábbi formátumban:

4.: 3! = 6, isOdd=false

A kiszámított érték esetenként kifejezetten nagy is lehet.

Architektúra

A rendszer az alábbi komponensekből épül fel, melyet a main indít.

Mermaid markup
flowchart LR
    main[[main.go]] --> factorizer[Factorizer.go] --> pc(parityChecker.go)

A faktorizálást párhuzamosan végzi cpuszám+1 gorutin.

Inizializálás(StartWorkers) során létrehozza ezeket a rutinokat, melyek párhuzamosan várnak inputra, és párhuzamosan írják vissza az outputot. A workerek egymásról nem tudnak, egymásra nem várnak. Az inicializátor további feladata, hogy a kapott feladatokat áttranszformálja egy olyan formátummá, ami utána sorrendtartóan olvasható, és ezt adja át a feldolgozó egységeknek.

Mermaid markup
aw1(go asyncWorkerJobRunner 1) --> w1(go asyncWorker) wm --> aw2(go asyncWorkerJobRunner 2) --> w2(go asyncWorker) wm --> aw3(go asyncWorkerJobRunner ...) --> w3(go asyncWorker) wm --> aw4(go asyncWorkerJobRunner n) --> w4(go asyncWorker) wm ==> asyncTransformInputToIoChan ">
flowchart TB
    wm("StartWorkers(workerCount, inputChan, outputChanChan)")
    wm -->  aw1(go asyncWorkerJobRunner 1) --> w1(go asyncWorker)
    wm -->  aw2(go asyncWorkerJobRunner 2) --> w2(go asyncWorker)
    wm -->  aw3(go asyncWorkerJobRunner ...) --> w3(go asyncWorker)
    wm -->  aw4(go asyncWorkerJobRunner n) --> w4(go asyncWorker)
    wm ==> asyncTransformInputToIoChan
    

Az asyncWorkerJobRunner dolga, hogy figyelje az új feldolgozandókat, elindítsa és leállítsa az asyncWorker-t, figyelje az eltelt időket, és az alapján timeoutolja a feldolgozást.

Az asyncWorker végzi a szükséges matematikai művelet elvégzését. (Esetünkben faktoriális számítást.) Érvénytelen bemenetre pánikol. Futása megszakítható. Az eredményt channelbe írja vissza.

Az asyncTransformInputToIoChan transzformálja a bemeneti folymatot egy olyan struktúrába, ami két elemet tartalmaz: az megoldandó feladatot, és egy, a megoldást váró channelt. A megoldást váró channelt elküldi a kimenet channelbe is, így a bemenettel garantáltan azonos sorrendben jön létre egy kimeneti channelt tartalmazó channel. Az egyes al-elemekre így már lehet várni, és azok az eredmény elkészülte után lesznek olvashatóak.

Alapértelmezés szerint a konfigurációnak megfelelő bemenetet generál, és a generált sorrendben írja ki. A kiírást a parityChecker, C-ben írt paritás-ellenörzőn is átfuttatja, amivel kibővíti az eredmény-sort.

Refs

Similar Resources

📁 Examples for 🚀 Fiber - Express inspired web framework written in Go

📁 Examples for 🚀 Fiber - Express inspired web framework written in Go

Dec 29, 2022

Example skills and a cli utility written in Go for interacting with Webex Assistant Skills

Webex Assistant Skills - Go This repository holds example skills and a cli utility written in Go for interacting with Webex Assistant Skills. It is in

Oct 29, 2021

Exercise project written in Go that I did on my own during the course "gRPC [Golang] Master Class: Build Modern API & Microservices" taught by Stephane Maarek on Udemy

calculator Exercise project written in Go that I did on my own during the course "gRPC [Golang] Master Class: Build Modern API & Microservices" taught

Nov 9, 2022

An open source recommender system service written in Go

An open source recommender system service written in Go

gorse: Go Recommender System Engine Gorse is an open-source recommendation system written in Go. Gorse aims to be a universal open-source recommender

Jan 1, 2023

This is a test / interview implementation, written in go

This is a test / interview implementation, written in go

Factorizer This is a test / interview implementation, written in go. Author's kinda first go project. Just move on. Számok Faktorializálása A faktoriz

Feb 9, 2022

Collection of Technical Interview Questions solved with Go

go-interview Collection of Technical Interview Questions solved with Go Algorithms A Star Datastructures Linked Lists Doubly Linked List Singly Linked

Jan 9, 2023

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

Learn how to design large-scale systems. Prep for the system design interview.  Includes Anki flashcards.

English ∙ 日本語 ∙ 简体中文 ∙ 繁體中文 | العَرَبِيَّة‎ ∙ বাংলা ∙ Português do Brasil ∙ Deutsch ∙ ελληνικά ∙ עברית ∙ Italiano ∙ 한국어 ∙ فارسی ∙ Polski ∙ русский язы

Jan 9, 2023

Most comprehensive list :clipboard: of tech interview questions :blue_book: of companies scraped from Geeksforgeeks, CareerCup and Glassdoor.

Most comprehensive list :clipboard: of tech interview questions :blue_book: of companies scraped from Geeksforgeeks, CareerCup and Glassdoor.

Companies* Companies E Expedia G Grab M MobiKwik N NEC Technologies P PayPal S Samsung Research Institute U Uber Y Yatra.com Z Zomato Announcements 👐

Dec 29, 2022

101+ coding interview problems in Go

116+ Coding Interview Problems with Detailed Solutions The Ultimate Go Study Guide eBook version → Join my mailing list to get the latest updates here

Dec 31, 2022

Collection of awesome interview references.

Collection of awesome interview references.

Awesome Interview Collection of awesome interview reference

Dec 31, 2022

💯 Materials to help you rock your next coding interview

Tech Interview Handbook Credits: Illustration by @leftaligned Read on the website Black Lives Matter. Support the Equal Justice Initiative What is thi

Jan 4, 2023

JumpCloud backend interview assignment

jc-assignment JumpCloud backend interview assignment Hello and thanks for speaking with me earlier this week. As may be apparent from the code, I'm ne

Nov 5, 2021

A programming job interview question problem

Unscramble a scrambled URL Problem statement The problem statement follows. I copied it literally because there's no good way to summarize and retain

Nov 9, 2021

A Simple Interview Problems With Golang

Interview_Problems we cannot pass more than 2 argument in slice append function either you can pass the slice unfurled or number of arguments comma se

Dec 30, 2021

Yandex interview for golang

Тестовые задания на интервью Яндекса при приёме на работу A. Камни и украшения Ограничение времени 1 секунда Ограничение памяти 64Mb Ввод стандартный

May 26, 2022

A Google interview task my friend told me about.

deriving π given a normal distribution Try it yourself: package main import ( "fmt" "github.com/cpmech/gosl/rnd" ) // normal returns a number acc

Dec 16, 2021

Form3tech interview

Form3 Take Home Exercise Engineers at Form3 build highly available distributed systems in a microservices environment. Our take home test is designed

Jan 13, 2022

Practice-dsa-go - Data Structures and Algorithms for Interview Preparation in Go

Data Structures and Algorithms for Interview Preparation in Go Data Structures K

Jul 3, 2022

Cracking the Coding Interview, 6th Ed

Cracking the Coding Interview, 6th Ed. In order to stay sharp, I try to solve a few of these every week. The repository is organized by chapter. Each

Jan 26, 2022
Collection of awesome interview references.
Collection of awesome interview references.

Awesome Interview Collection of awesome interview reference

Dec 31, 2022
💯 Materials to help you rock your next coding interview

Tech Interview Handbook Credits: Illustration by @leftaligned Read on the website Black Lives Matter. Support the Equal Justice Initiative What is thi

Jan 4, 2023
A programming job interview question problem

Unscramble a scrambled URL Problem statement The problem statement follows. I copied it literally because there's no good way to summarize and retain

Nov 9, 2021
Form3tech interview

Form3 Take Home Exercise Engineers at Form3 build highly available distributed systems in a microservices environment. Our take home test is designed

Jan 13, 2022
Cracking the Coding Interview, 6th Ed

Cracking the Coding Interview, 6th Ed. In order to stay sharp, I try to solve a few of these every week. The repository is organized by chapter. Each

Jan 26, 2022
Test-Driven Development code kata in Golang

Bowling Kata Golang Test-Driven Development code kata in Golang Bowling Rules The game consists of 10 frames. In each frame the player has two rolls t

Jan 5, 2022
slang 🐕‍🦺 | a Programing language written to understand how programing languages are written

slang ??‍?? goal was to learn how a interpreter works, in other works who does these programing languages i use on daily basis works behind the seen h

Nov 18, 2021
A Go implementation of the strobemers (https://github.com/ksahlin/strobemers)
A Go implementation of the strobemers (https://github.com/ksahlin/strobemers)

Strobemers in Go Introduction This is a Go implementation of the strobemers (minstrobes and randstrobes), with some differences. The implementation of

Sep 28, 2022
DCI Architecture Implementation
DCI Architecture Implementation

前言 在面向对象编程的理念里,应用程序是对现实世界的抽象,我们经常会将现实中的事物建模为编程语言中的类/对象(“是什么”),而事物的行为则建模为方法(“做什么”)。面向对象编程有三大基本特性(封装、继承/组合、多态)和五大基本原则(单一职责原则、开放封闭原则、里氏替换原则、依赖倒置原则、接口分离原则

Dec 15, 2022
Implementation diploma work for YANDEX course "GO Musthave"

go-musthave-diploma-tpl Шаблон репозитория для индивидуального дипломного проекта курса "Самостоятельный Go-разработчик" Начало работы Склонируйте реп

Apr 12, 2022