Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

268
Visualizações
"cat /dev/random" versus "tail -f /dev/random"

Statement

cat /dev/random

keeps producing output, as expected, but

tail -f /dev/random

hangs (at least on OSX and SUSE). Why the latter statement hangs?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

tail -f does several things:

  1. Find the end of the stream, either by reading until reaching an EOF or by doing a seek to the end (an operation not available on /dev/random).
  2. Back up a certain length (possibly by retaining a buffer of an appropriate length of contents recently read, possibly by retaining a list of seek positions for the last N lines during the initial scan, or by some other means), and print the contents between that point and the end.
  3. Continue to print new contents past that point as such contents become available.

If there is no end -- as is the case for /dev/random -- that first step will never complete.

cat does not need to find an end to seek back from it, and so it has no point of failure associated.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda