エンジニア

なんくるないさ

「このブログはアフィリエイト広告を利用しています」

情報工学の総復習

ドメイン知識の問題集や勉強の仕方(随時更新)を見て、まともに回答できる気がしなかったので、まとめました。

Network

質問1:TCPUDPの違いを説明してください。

  • TCPは、信頼性のある接続指向のプロトコルであり、デバイス間で確実かつ順序通りにデータを送信します。
  • UDPは、非接続指向のプロトコルであり、データの確実な配信や順序の保証は行わず、高速なデータ送信を提供します。

  • TCP (Transmission Control Protocol) is a reliable and connection-oriented protocol. It ensures the delivery of data by establishing a reliable connection and handling packet retransmissions if necessary.

  • UDP (User Datagram Protocol) is a simpler and connectionless protocol. It does not guarantee reliable delivery and does not establish a connection before sending data.

TCP vs UDP

参照

質問2:IPパケットとは何ですか?

  • IPパケットは、インターネット上でデータを送信するための単位です。
  • IPパケットには、送信元と宛先のIPアドレス、データの一部(ペイロード)、および制御情報(ヘッダ)が含まれます。
  • ネットワークを介してパケットがルーティングされ、宛先に到着すると再構築されます。

  • An IP packet is a unit of data that is transmitted over an IP network.

  • It consists of a header and a payload.
  • The header contains information such as the source and destination IP addresses, protocol information, and other control fields.
  • The payload contains the actual data being transmitted.

質問3:TCPの最適化についていくつか挙げてください。

  • TCPウィンドウサイズの調整: より大きなウィンドウサイズを設定することで、送信元と宛先のデータのやり取りを効率化します。
  • Nagle's Algorithmの調整: データの送信を遅延させることで、ネットワークの混雑を軽減し、効率的なデータ転送を実現します。
  • TCP Fast RetransmitとTCP Fast Recoveryの有効化: パケットのロスを検出し、再送信を早めることで通信の効率性を向上させます。

  • TCP optimizations include techniques such as TCP window scaling, selective acknowledgments (SACK), and congestion control algorithms like TCP Vegas or TCP Cubic.

  • These optimizations aim to improve the performance and efficiency of TCP connections, especially in high-bandwidth or high-latency networks.

質問4:TCPの3ウェイハンドシェイクとは何ですか?

  • TCPの3ウェイハンドシェイクは、TCP接続を確立するための手順です。
  • 1つ目のステップでは、クライアントがサーバに接続要求を送信します(SYNパケット)。
  • 2つ目のステップでは、サーバが接続要求を受け入れ、クライアントに確認応答を送信します(SYN-ACKパケット)。
  • 最後のステップでは、クライアントが確認応答を受け取り、サーバに対して接続確立を通知します(ACKパケット)。

  • The TCP three-way handshake is a process used to establish a TCP connection between a client and a server.

  • It involves three steps:
  • The client sends a SYN (synchronize) packet to the server to initiate the connection.
  • The server responds with a SYN-ACK (synchronize-acknowledgment) packet, indicating its willingness to establish a connection.
  • The client sends an ACK (acknowledgment) packet back to the server, confirming the connection establishment.

質問5:HTTP/2はHTTP/1.1とどのように異なるのですか?

  • HTTP/2は、パフォーマンスを向上させるための新しいプロトコルであり、HTTP/1.1と比較していくつかの重要な違いがあります。
  • HTTP/2では、1つの接続で複数の要求と応答を並行して処理することができます(マルチプレクシング)。
  • HTTP/2では、データの圧縮、サーバプッシュ、優先順位付けなどの新しい機能が導入され、通信の効率性が向上します。

  • HTTP/2 is a protocol that has several important differences compared to HTTP/1.1.

  • In HTTP/2, multiple requests and responses can be processed concurrently over a single connection (multiplexing).
  • HTTP/2 introduces new features such as data compression, server push, and prioritization, which improve communication efficiency.

質問6:HTTPSとHTTPの違いを説明してください。

  • HTTPSは、HTTPにセキュリティを追加したプロトコルです。
  • HTTPSでは、通信が暗号化され、データの盗聴や改ざんを防ぎます。
  • HTTPでは、データは平文で送信されるため、セキュリティ上のリスクがあります。

  • HTTPS is a protocol that adds security to HTTP.

  • In HTTPS, communication is encrypted, protecting against eavesdropping and tampering.
  • In HTTP, data is transmitted in plaintext, which poses security risks.

質問7:TLSはどのように動作するのですか?

  • TLS(Transport Layer Security)は、セキュアな通信を提供するためのプロトコルです。
  • TLSでは、暗号化、認証、データ整合性の確保などのセキュリティ機能が使用されます。
  • クライアントとサーバの間でハンドシェイクが行われ、暗号化されたセッションキーが生成されます。

  • TLS (Transport Layer Security) is a protocol that provides secure communication.

  • TLS involves encryption, authentication, and ensuring data integrity.
  • A handshake process occurs between the client and server, resulting in the creation of an encrypted session key.

質問8:相互TLS(mTLS)とは何ですか?

  • 相互TLS(mTLS)は、通信の両端が互いに証明書を使用して相互に認証するセキュリティプロトコルです。
  • サーバとクライアントの双方が証明書を持ち、相互の身元確認が行われます。
  • mTLSは、より強力なセキュリティを提供し、中間者攻撃や不正なアクセスを防ぐのに役立ちます。

  • Mutual TLS (mTLS) is a security protocol where both communication endpoints authenticate each other using certificates.

  • Both the server and the client have certificates, and mutual identification is performed.
  • mTLS provides stronger security and helps prevent man-in-the-middle attacks or unauthorized access.

質問9:10.0.0.5/24の中の/24は何を意味しますか?

  • /24は、IPアドレスサブネットマスクを表す記法です。
  • /24は、24ビットがネットワーク部、残りのビットがホスト部を表します。
  • つまり、10.0.0.5/24は、10.0.0.0というネットワークの一部であり、ホスト部には5というアドレスが割り当てられていることを示します。

  • /24 represents the subnet mask of an IP address.

  • In this case, 10.0.0.5/24 indicates that it is part of the 10.0.0.0 network, and the host part has been assigned the address 5.

質問10:IPv6は何のために使用されますか?

  • IPv6は、インターネットのIPアドレス枯渇問題を解決するために開発された次世代のIPプロトコルです。
  • IPv6は、より多くのIPアドレスを提供し、デバイスやインターネットへの接続数を増やすことができます。

  • IPv6 is the next-generation IP protocol developed to address the IP address exhaustion issue on the Internet.

  • IPv6 provides a larger address space and allows for a higher number of connected devices and Internet growth.

質問11:ブラウザでURLを開くと何が起こりますか?

  • ブラウザでURLを開くと、以下のようなプロセスが行われます。
  • ブラウザは、入力されたURLを解析し、ホスト名(ドメイン名)とリソースパスに分割します。
  • ブラウザは、DNS(Domain Name System)を使用して、ホスト名をIPアドレスに解決します。
  • ブラウザは、解決されたIPアドレスに対してネットワーク接続を確立します。
  • ブラウザは、HTTPリクエストをサーバに送信し、要求されたリソース(HTML、画像、スクリプトなど)を取得します。
  • サーバは、ブラウザに対してHTTPレスポンスとしてリソースを返送します。
  • ブラウザは、受け取ったリソースを解析し、表示や処理を行い、ユーザにコンテンツを表示します。

  • When you open a URL in a browser, the browser performs the following steps:

  • Parses the URL to extract the hostname and resource path.
  • Resolves the hostname to an IP address using DNS.
  • Establishes a network connection to the resolved IP address.
  • Sends an HTTP request to the server for the requested resource.
  • Receives the HTTP response containing the resource data.
  • Renders and displays the resource content in the browser window.

CPU

https://zenn.dev/antez/books/568dd4d86562a1/viewer/531a45 このサイトがわかりやすい。

Explain process vs thread (kernel perspective)

  • プロセスとスレッドの違いは、カーネルの視点から見ると次のようになります。
  • プロセスは、実行中のプログラムのインスタンスであり、リソース(メモリ、ファイルハンドルなど)とスレッド(実行単位)の集合です。
  • スレッドは、プロセス内で実行される個々の実行単位であり、プロセス内の共有リソースを利用します。

  • In the kernel perspective, a process is an instance of a running program. It represents a complete execution environment with its own memory space, file descriptors, and other resources. A process is managed by the operating system and can consist of one or more threads.

  • On the other hand, a thread is a unit of execution within a process. It represents a single sequence of instructions that can be scheduled and executed independently. Threads within the same process share the same memory space and resources.

How to kill a process

  • プロセスを終了させるには、以下の手順を実行します。
  • Unix/Linuxシステムでは、killコマンドを使用します。具体的なプロセスID(PID)を指定して、killコマンドを実行することでプロセスを終了させることができます。
  • Windowsシステムでは、タスクマネージャーやコマンドプロンプトのtaskkillコマンドを使用してプロセスを終了させることができます。

  • Killing a process means terminating its execution. In most operating systems, you can kill a process using specific commands or tools provided by the operating system.

  • For example, in Unix-based systems, the kill command is commonly used to send a termination signal to a process, which will result in its termination.

Process is dead. What can you do to debug?

  • プロセスが終了した場合、デバッグのために次のことができます。
  • ログファイルやコアダンプ(クラッシュダンプ)などのデバッグ情報を調べることで、プロセスの終了の原因を特定することができます。
  • デバッガを使用して、プロセスの実行中にブレークポイントを設定し、実行状態や変数の値などを調査することができます。

  • When a process is dead, meaning it has terminated unexpectedly, there are several steps you can take to debug the issue:

  • Check system logs: Examine system logs to see if any error messages or crash reports are available.
  • Analyze core dumps: If a core dump was generated, analyze it to get insights into the state of the process at the time of termination.
  • Review application code: Look for any potential bugs or issues in the code that could have led to the process termination.
  • Use debugging tools: Utilize debugging tools like debuggers or profilers to trace the execution flow and identify any errors or abnormal behavior.

What is a processor

  • プロセッサは、コンピュータの中央処理装置(CPU)のことです。プロセッサは、コンピュータが命令を実行し、計算を行うための重要な役割を果たします。

  • A processor, also known as a central processing unit (CPU), is the main component of a computer system responsible for executing instructions and performing calculations. It is often referred to as the "brain" of the computer. The processor interprets and executes instructions fetched from memory, performs arithmetic and logical operations, and manages the flow of data within the computer system.

What is the CPU clock rate

CPUクロックレートは、プロセッサの動作速度を表す指標です。クロックレートは、プロセッサが1秒間に何回の命令を実行できるかを示します。一般的な単位はギガヘルツ(GHz)です。

  • The CPU clock rate, measured in hertz (Hz), refers to the frequency at which the CPU's clock signal oscillates. It determines the speed at which the CPU can execute instructions. A higher clock rate generally indicates a faster CPU capable of processing instructions more quickly.

Explain CPU vs GPU. What are some GPU use cases

CPU(中央処理装置)とGPU(グラフィックス処理装置)の違いは次の通りです。

  • CPUは汎用的な処理を行い、プログラムの制御やデータ処理などを担当します。
  • GPUは主に画像やグラフィックスの処理に特化しており、高速な並列処理能力を持っています。
  • GPUの利用例は以下のようなものがあります。

  • ゲームや映画のリアルタイムのグラフィックス処理

  • 科学計算や機械学習などの高度な数値計算
  • 仮想現実(VR)や拡張現実(AR)の処理
  • 暗号通貨のマイニングなどの高負荷な演算処理

  • CPU (Central Processing Unit) and GPU (Graphics Processing Unit) are both types of processors, but they have different architectures and are optimized for different tasks:

  • CPU: CPUs are designed for general-purpose computing. They excel at handling complex tasks that require high single-threaded performance, such as running operating systems, executing applications, and performing calculations that involve branching and decision-making.
  • GPU: GPUs are specialized processors designed for parallel processing and efficient handling of graphics-related tasks. They are particularly well-suited for rendering images, running graphics-intensive applications like video games, performing machine learning computations, and accelerating certain scientific and computational tasks.

What is a kernel scheduler

  • カーネルスケジューラは、マルチタスキングオペレーティングシステムにおいて、複数のプロセスやスレッドの実行順序を管理する役割を持つカーネルコンポーネントです。
  • スケジューラは利用可能なリソースを効果的に割り当て、プロセスやスレッドの実行優先順位を決定します。

  • A kernel scheduler is a component of the operating system's kernel responsible for managing the allocation of CPU resources to different processes and threads.

  • It determines the order and duration of execution for each process or thread, aiming to optimize CPU utilization and ensure fairness among competing tasks.

What is a system call (syscall)? Can you give some examples of them

  • システムコール(システム呼び出し)は、プログラムがオペレーティングシステムのサービスを利用するために使用するインタフェースです。
  • システムコールを通じて、プログラムはカーネル内の機能(ファイル操作、プロセス制御など)を利用することができます。

  • システムコールの例には以下があります。

  • ファイルのオープン、クローズ、読み書きなどのファイル操作
  • プロセスの生成、終了、スケジュールなどのプロセス制御
  • メモリの割り当てや解放などのメモリ管理
  • ネットワーク通信の送受信などのネットワーク操作

  • A system call (syscall) is a mechanism that allows user-level programs to request services from the operating system.

  • It serves as an interface between the user space and the kernel space. Examples of system calls include:
  • open(): Opens a file or device.
  • read(): Reads data from a file or device.
  • write(): Writes data to a file or device.
  • fork(): Creates a new process.
  • exec(): Replaces the current process with a new executable.

Explain kernel space vs user space

  • カーネル空間とユーザ空間は、オペレーティングシステムの設計において重要な概念です。
  • カーネル空間は、オペレーティングシステムカーネルが実行される領域であり、特権モードで動作します。カーネルはシステム全体の管理や保護などの重要なタスクを担当します。
  • ユーザ空間は、通常のアプリケーションが実行される領域であり、制限された権限で動作します。ユーザ空間ではアプリケーションの処理やデータ操作が行われます。

  • In an operating system, kernel space and user space are two distinct memory regions with different levels of privileges:

  • Kernel Space: Kernel space is the protected memory region where the operating system's kernel resides. It contains the core components and services of the operating system, such as device drivers, schedulers, and memory management. Access to kernel space is restricted and requires higher privileges.
  • User Space: User space is the memory region where user-level programs and applications run. It contains the user's code, data, and libraries. User space programs have limited privileges and rely on system calls to access the resources and services provided by the kernel.

ここからは、自分の学習用

jQuryとは

  • htmlタグ(DOM)を指定して、属性を書き換えることができる。
  • DOMを操作するためのJavaScriptのライブラリ

Document Object Modelの略「ドム」。HTMLやXML文書を取り扱うためのAPI。プログラムからHTML/XMLを操作する仕組み。

フロントエンドkey

key属性をつけることで、差分検出ができて早い

Reducerとは

reducerを使う理由

reducerの実装