{"id":90050,"date":"2020-07-28T13:42:44","date_gmt":"2020-07-28T11:42:44","guid":{"rendered":"https:\/\/prohoster.info\/blog\/novosti-interneta\/google-nachal-otkrytie-realizaczii-modeli-potokov-mn"},"modified":"2020-07-28T13:42:44","modified_gmt":"2020-07-28T11:42:44","slug":"google-nachal-otkrytie-realizaczii-modeli-potokov-mn","status":"publish","type":"post","link":"https:\/\/prohoster.info\/pt\/blog\/news\/google-nachal-otkrytie-realizaczii-modeli-potokov-mn","title":{"rendered":"O Google iniciou a implementa\u00e7\u00e3o do modelo de threads M:N","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>A empresa Google <noindex><a rel=\"nofollow\" href=\"https:\/\/lore.kernel.org\/lkml\/20200722234538.166697-1-posk@posk.io\/\">ofereceu<\/a><\/noindex> um conjunto inicial de patches para inclus\u00e3o no n\u00facleo Linux com a implementa\u00e7\u00e3o de componentes necess\u00e1rios para suportar o funcionamento do modelo de threads M:N. A iniciativa do Google est\u00e1 relacionada \u00e0 abertura de uma API que estava em desenvolvimento a portas fechadas <noindex><a rel=\"nofollow\" href=\"http:\/\/pdxplumbers.osuosl.org\/2013\/ocw\/\/system\/presentations\/1653\/original\/LPC%20-%20User%20Threading.pdf\">SwitchTo<\/a><\/noindex> para o n\u00facleo Linux, que suporta a implementa\u00e7\u00e3o de um subsistema de m\u00faltiplas threads em espa\u00e7o de usu\u00e1rio, usando o modelo de threads M:N. O subsistema \u00e9 utilizado pelo Google para garantir o funcionamento de servi\u00e7os que requerem lat\u00eancias m\u00ednimas. O agendamento e o gerenciamento da distribui\u00e7\u00e3o de threads s\u00e3o feitos inteiramente no espa\u00e7o de usu\u00e1rio, o que permite reduzir significativamente o n\u00famero de opera\u00e7\u00f5es de troca de contexto ao minimizar as chamadas de sistema.<\/p>\n<p>Para garantir o funcionamento do subsistema especificado no n\u00edvel do n\u00facleo do Linux, foi implementada a API SwitchTo, que oferece tr\u00eas opera\u00e7\u00f5es b\u00e1sicas \u2014 wait, resume e swap (altern\u00e2ncia). Para inclus\u00e3o no n\u00facleo, foi proposto um c\u00f3digo para uma nova opera\u00e7\u00e3o FUTEX_SWAP, que complementa <noindex><a rel=\"nofollow\" href=\"https:\/\/man7.org\/linux\/man-pages\/man2\/futex.2.html\">FUTEX_WAIT e FUTEX_WAKE<\/a><\/noindex>, e fornece uma base para a cria\u00e7\u00e3o de bibliotecas de m\u00faltiplas threads em espa\u00e7o de usu\u00e1rio. O FUTEX_SWAP tamb\u00e9m pode ser utilizado para a troca de mensagens entre tarefas, de forma semelhante ao RPC. Por exemplo, atualmente, para enviar uma mensagem entre tarefas, \u00e9 necess\u00e1rio realizar pelo menos quatro chamadas FUTEX_WAIT e FUTEX_WAKE, enquanto o uso do FUTEX_SWAP permitir\u00e1 uma opera\u00e7\u00e3o \u00fanica que ser\u00e1 executada de 5 a 10 vezes mais r\u00e1pido.<\/p>\n<p><center><noindex><a rel=\"nofollow\" href=\"http:\/\/pdxplumbers.osuosl.org\/2013\/ocw\/\/system\/presentations\/1653\/original\/LPC%20-%20User%20Threading.pdf\"><img decoding=\"async\" alt=\"O Google iniciou a implementa\u00e7\u00e3o do modelo de threads M:N\" src=\"\/wp-content\/uploads\/2020\/07\/a8a6049cd1d1aafd2a8caf08afcf3d6d.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><\/center><\/p>\n<p>Atualmente, na pr\u00e1tica, s\u00e3o utilizadas principalmente os modelos de threads 1:1 e N:1. O modelo 1:1 \u00e9 usado em <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Native_POSIX_Thread_Library\">NPTL<\/a><\/noindex> (threads POSIX) e <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/LinuxThreads\">LinuxThreads<\/a><\/noindex>, e implica uma correspond\u00eancia direta de uma thread no espa\u00e7o de usu\u00e1rio com uma thread (unidade de agendamento) no n\u00edvel do n\u00facleo. O modelo N:1 \u00e9 implementado em <noindex><a rel=\"nofollow\" href=\"https:\/\/www.gnu.org\/software\/pth\/\">GNU Pth<\/a><\/noindex>, deslocando a gest\u00e3o de threads para o espa\u00e7o de usu\u00e1rio e permitindo que N threads em espa\u00e7o de usu\u00e1rio fiquem ligadas a uma \u00fanica thread no n\u00facleo, sendo que o n\u00facleo n\u00e3o tem informa\u00e7\u00e3o sobre as threads de usu\u00e1rio.<\/p>\n<p>A principal desvantagem do modelo 1:1 s\u00e3o os altos custos de troca de contexto entre o n\u00facleo e o espa\u00e7o do usu\u00e1rio. O modelo N:1 resolve esse problema, mas cria um novo \u2014 como o thread no n\u00facleo \u00e9 uma unidade indivis\u00edvel de planejamento de execu\u00e7\u00e3o, os threads de usu\u00e1rio vinculados a uma thread no n\u00facleo do sistema operacional n\u00e3o podem ser escalonados entre os n\u00facleos da CPU e acabam ficando vinculados a um \u00fanico n\u00facleo da CPU.<\/p>\n<p>O modelo M:N \u00e9 h\u00edbrido e elimina todas as desvantagens descritas acima ao mapear N fluxos no espa\u00e7o do usu\u00e1rio para M fluxos no n\u00facleo do sistema operacional, o que permite reduzir o overhead da troca de contexto e garantir a escalabilidade entre os n\u00facleos da CPU. O pre\u00e7o dessa op\u00e7\u00e3o \u00e9 a complexidade adicional na implementa\u00e7\u00e3o do planejador de fluxos no espa\u00e7o do usu\u00e1rio e a necessidade de mecanismos de sincroniza\u00e7\u00e3o das a\u00e7\u00f5es com o planejador do n\u00facleo.<\/p>\n<p><center><div class=\"youtube-placeholder\" data-id=\"KXuZi9aeGTw\" onclick=\"loadVideo(this)\">\r\n        <img decoding=\"async\" src=\"https:\/\/img.youtube.com\/vi\/KXuZi9aeGTw\/hqdefault.jpg\" alt=\"Por que no hosting comum a administra\u00e7\u00e3o do PrestaShop \u00e9 lenta, e no seu n\u00e3o \u00e9?\" loading=\"lazy\" width=\"480\" height=\"360\" style=\"width:100%;height:auto;\">\r\n        <div class=\"play-button\"><\/div>\r\n    <\/div><\/center><\/p>\n<p><noindex><a rel=\"nofollow\" name=\"link\"><\/a><\/noindex><\/p>\n<p>Fonte: <a \ncontent=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/www.opennet.ru\/opennews\/art.shtml?num=53443\">opennet.ru<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u044f\u0434\u0440\u0430 Linux \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0442\u0447\u0435\u0439 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 M:N. \u0418\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u0430 Google \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0437\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c\u0438 \u0434\u0432\u0435\u0440\u044f\u043c\u0438 API SwitchTo \u0434\u043b\u044f \u044f\u0434\u0440\u0430 Linux, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0449\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0442\u043e\u043a\u043e\u0432 M:N. \u041f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Google \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":90051,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[702],"tags":[],"class_list":["post-90050","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.3 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u044f\u0434\u0440\u0430 Linux \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0442\u0447\u0435\u0439 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/pt\/blog\/news\/google-nachal-otkrytie-realizaczii-modeli-potokov-mn\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.3\" \/>\n\t\t<meta property=\"og:locale\" content=\"pt_PT\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47Google \u043d\u0430\u0447\u0430\u043b \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 M:N | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u044f\u0434\u0440\u0430 Linux \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0442\u0447\u0435\u0439 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/pt\/blog\/news\/google-nachal-otkrytie-realizaczii-modeli-potokov-mn\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-07-28T11:42:44+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-07-28T11:42:44+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Google come\u00e7ou a implementa\u00e7\u00e3o do modelo de fluxos M:N | ProHoster","description":"A empresa Google prop\u00f4s a inclus\u00e3o no n\u00facleo do Linux do primeiro conjunto de patches com a implementa\u00e7\u00e3o.","canonical_url":"https:\/\/prohoster.info\/pt\/blog\/news\/google-nachal-otkrytie-realizaczii-modeli-potokov-mn","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"pt_PT","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47Google \u043d\u0430\u0447\u0430\u043b \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 M:N | ProHoster","og:description":"\u041a\u043e\u043c\u043f\u0430\u043d\u0438\u044f Google \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u043b\u0430 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 \u044f\u0434\u0440\u0430 Linux \u043f\u0435\u0440\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0442\u0447\u0435\u0439 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439.","og:url":"https:\/\/prohoster.info\/pt\/blog\/news\/google-nachal-otkrytie-realizaczii-modeli-potokov-mn","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-07-28T11:42:44+00:00","article:modified_time":"2020-07-28T11:42:44+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"90050","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 12:59:44","updated":"2022-10-01 00:41:43","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts\/90050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/comments?post=90050"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/posts\/90050\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/media\/90051"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/media?parent=90050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/categories?post=90050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/pt\/wp-json\/wp\/v2\/tags?post=90050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}